From 0cd7307b91e4a3edfce544cf33377bc8a0836bdb Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Sat, 10 Oct 2026 17:39:00 +0000 Subject: [PATCH] test(rust): read the blocked IP fixture through an rstest once fixture Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm-rust/crates/http/src/media.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/litellm-rust/crates/http/src/media.rs b/litellm-rust/crates/http/src/media.rs index 349a6f26a51..4e778d6fd26 100644 --- a/litellm-rust/crates/http/src/media.rs +++ b/litellm-rust/crates/http/src/media.rs @@ -623,14 +623,19 @@ mod tests { } } - #[test] - fn blocks_everything_the_python_policy_blocks() { - let fixture: BlockedIpFixture = serde_json::from_str(include_str!(concat!( + #[rstest::fixture] + #[once] + fn python_verdicts() -> BlockedIpFixture { + serde_json::from_str(include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/generated/blocked_ips.json" ))) - .expect("blocked_ips.json matches the fixture schema"); - let verdicts: Vec<(IpAddr, bool, bool)> = fixture + .expect("blocked_ips.json matches the fixture schema") + } + + #[rstest::rstest] + fn blocks_everything_the_python_policy_blocks(python_verdicts: &BlockedIpFixture) { + let verdicts: Vec<(IpAddr, bool, bool)> = python_verdicts .rows .iter() .map(|row| (row.address, row.blocked, is_blocked_ip(row.address)))