From 780d4ef20765e986f0931a5b43f44ee8858ede2a Mon Sep 17 00:00:00 2001 From: Josh Vera Date: Sun, 13 Jul 2025 11:59:54 -0600 Subject: [PATCH] fix: Clear restriction service in o3-pro test setup for proper isolation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The o3-pro test now clears the restriction service singleton in its setup_method to ensure it re-reads environment variables set by the @patch.dict decorator. This prevents cached restrictions from previous tests (like test_fallback_with_shorthand_restrictions) from blocking the o3-pro model. This is a minimal, targeted fix that only affects the specific test that needs it, without breaking other tests that may depend on the restriction service state. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tests/test_o3_pro_output_text_fix.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_o3_pro_output_text_fix.py b/tests/test_o3_pro_output_text_fix.py index b465425..2709305 100644 --- a/tests/test_o3_pro_output_text_fix.py +++ b/tests/test_o3_pro_output_text_fix.py @@ -41,6 +41,12 @@ class TestO3ProOutputTextFix: # Use the new public API for registry cleanup ModelProviderRegistry.reset_for_testing() # Provider registration is now handled by inject_transport helper + + # Clear restriction service to ensure it re-reads environment + # This is necessary because previous tests may have set restrictions + # that are cached in the singleton + import utils.model_restrictions + utils.model_restrictions._restriction_service = None def teardown_method(self): """Clean up after test to ensure no state pollution."""