From 1b09238c7a8374fe73c84be3106a5c845b4cd8dd Mon Sep 17 00:00:00 2001 From: Josh Vera Date: Sun, 13 Jul 2025 09:56:10 -0600 Subject: [PATCH] cleanup: Remove redundant o3-pro test files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bisect and simplified test files were created during investigation to understand fixture requirements, but they test the same core functionality as test_o3_pro_output_text_fix.py. Now that we have the final clean implementation, these files are redundant. Removed: • test_o3_pro_fixture_bisect.py - 4 test methods testing fixture combinations • test_o3_pro_simplified.py - 2 test methods testing minimal requirements The main test_o3_pro_output_text_fix.py remains and covers all the necessary o3-pro output_text parsing validation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tests/test_o3_pro_fixture_bisect.py | 106 -------------------------- tests/test_o3_pro_simplified.py | 114 ---------------------------- 2 files changed, 220 deletions(-) delete mode 100644 tests/test_o3_pro_fixture_bisect.py delete mode 100644 tests/test_o3_pro_simplified.py diff --git a/tests/test_o3_pro_fixture_bisect.py b/tests/test_o3_pro_fixture_bisect.py deleted file mode 100644 index 5df185c..0000000 --- a/tests/test_o3_pro_fixture_bisect.py +++ /dev/null @@ -1,106 +0,0 @@ -"""Bisect which operations in allow_all_models fixture are actually needed""" - -from pathlib import Path - -import pytest - -from providers import ModelProviderRegistry -from tests.transport_helpers import inject_transport -from tools.chat import ChatTool - -cassette_dir = Path(__file__).parent / "openai_cassettes" - - -class TestO3ProFixtureBisect: - """Test different combinations of fixture operations""" - - @pytest.mark.asyncio - @pytest.mark.no_mock_provider - async def test_minimal_just_api_key(self, monkeypatch): - """Test 1: Only set API key, no other operations""" - cassette_path = cassette_dir / "o3_pro_basic_math.json" - if not cassette_path.exists(): - pytest.skip("Cassette not found") - - # Only set API key - monkeypatch.setenv("OPENAI_API_KEY", "dummy-key-for-replay") - - # Simplified transport injection - just one line! - inject_transport(monkeypatch, cassette_path) - - chat_tool = ChatTool() - arguments = {"prompt": "What is 2 + 2?", "model": "o3-pro", "temperature": 1.0} - - result = await chat_tool.execute(arguments) - assert result is not None - print("Test 1 (API key only) passed!") - - @pytest.mark.asyncio - @pytest.mark.no_mock_provider - async def test_api_key_plus_cache_clear(self, monkeypatch): - """Test 2: API key + cache clear only""" - cassette_path = cassette_dir / "o3_pro_basic_math.json" - if not cassette_path.exists(): - pytest.skip("Cassette not found") - - # Set API key and clear cache - monkeypatch.setenv("OPENAI_API_KEY", "dummy-key-for-replay") - ModelProviderRegistry.clear_cache() - - # Simplified transport injection - just one line! - inject_transport(monkeypatch, cassette_path) - - chat_tool = ChatTool() - arguments = {"prompt": "What is 2 + 2?", "model": "o3-pro", "temperature": 1.0} - - result = await chat_tool.execute(arguments) - assert result is not None - print("Test 2 (API key + cache clear) passed!") - - @pytest.mark.asyncio - @pytest.mark.no_mock_provider - async def test_targeted_o3_pro_only(self, monkeypatch): - """Test 3: Allow only o3-pro specifically""" - cassette_path = cassette_dir / "o3_pro_basic_math.json" - if not cassette_path.exists(): - pytest.skip("Cassette not found") - - # Set API key and allow only o3-pro - monkeypatch.setenv("OPENAI_API_KEY", "dummy-key-for-replay") - monkeypatch.setenv("OPENAI_ALLOWED_MODELS", "o3-pro") - monkeypatch.setattr("utils.model_restrictions._restriction_service", None) - ModelProviderRegistry.clear_cache() - - # Simplified transport injection - just one line! - inject_transport(monkeypatch, cassette_path) - - chat_tool = ChatTool() - arguments = {"prompt": "What is 2 + 2?", "model": "o3-pro", "temperature": 1.0} - - result = await chat_tool.execute(arguments) - assert result is not None - print("Test 3 (targeted o3-pro only) passed!") - - @pytest.mark.asyncio - @pytest.mark.no_mock_provider - async def test_full_fixture_operations(self, monkeypatch): - """Test 4: All fixture operations (baseline)""" - cassette_path = cassette_dir / "o3_pro_basic_math.json" - if not cassette_path.exists(): - pytest.skip("Cassette not found") - - # Full fixture operations - monkeypatch.setattr("utils.model_restrictions._restriction_service", None) - monkeypatch.setenv("ALLOWED_MODELS", "") - monkeypatch.setenv("OPENAI_API_KEY", "dummy-key-for-replay") - ModelProviderRegistry.clear_cache() - - # Simplified transport injection - just one line! - inject_transport(monkeypatch, cassette_path) - - chat_tool = ChatTool() - arguments = {"prompt": "What is 2 + 2?", "model": "o3-pro", "temperature": 1.0} - - result = await chat_tool.execute(arguments) - assert result is not None - print("Test 4 (full fixture ops) passed!") diff --git a/tests/test_o3_pro_simplified.py b/tests/test_o3_pro_simplified.py deleted file mode 100644 index 068ef81..0000000 --- a/tests/test_o3_pro_simplified.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -Simplified o3-pro test demonstrating minimal fixture requirements. - -Based on bisection testing, this test proves that only the API key -is needed - no model restrictions or registry operations required. -""" - -import os -from pathlib import Path - -import pytest -from dotenv import load_dotenv - -from tests.transport_helpers import inject_transport -from tools.chat import ChatTool - -# Load environment variables from .env file -load_dotenv() - -# Use absolute path for cassette directory -cassette_dir = Path(__file__).parent / "openai_cassettes" -cassette_dir.mkdir(exist_ok=True) - - -@pytest.fixture -def dummy_api_key(monkeypatch): - """Minimal fixture - just set the API key for transport replay.""" - monkeypatch.setenv("OPENAI_API_KEY", "dummy-key-for-replay") - - -@pytest.mark.asyncio -class TestO3ProSimplified: - """Test o3-pro with minimal setup - no unnecessary registry operations.""" - - @pytest.mark.no_mock_provider # Disable provider mocking for this test - @pytest.mark.usefixtures("dummy_api_key") - async def test_o3_pro_minimal_fixture(self, monkeypatch): - """Test that o3-pro works with just the API key set.""" - cassette_path = cassette_dir / "o3_pro_basic_math.json" - - # Skip if cassette doesn't exist (for test suite runs) - if not cassette_path.exists(): - if os.getenv("OPENAI_API_KEY"): - print(f"Recording new cassette at {cassette_path}") - else: - pytest.skip("Cassette not found and no OPENAI_API_KEY to record new one") - - # Simplified transport injection - just one line! - inject_transport(monkeypatch, cassette_path) - - # Execute ChatTool test with custom transport - chat_tool = ChatTool() - arguments = {"prompt": "What is 2 + 2?", "model": "o3-pro", "temperature": 1.0} - - result = await chat_tool.execute(arguments) - - # Verify we got a valid response - assert result is not None, "Should get response from ChatTool" - assert isinstance(result, list), "ChatTool should return list of content" - assert len(result) > 0, "Should have at least one content item" - - # Get the text content - content_item = result[0] - assert content_item.type == "text", "First item should be text content" - - # Parse and verify the response - import json - - text_content = content_item.text - response_data = json.loads(text_content) - - # Verify response structure - assert "status" in response_data - assert "content" in response_data - assert "metadata" in response_data - - # Skip further checks if error response - if response_data["status"] == "error": - print(f"⚠️ Got error response: {response_data['content']}") - return - - # Verify the answer - content = response_data["content"] - assert "4" in content, f"Response should contain '4', got: {content[:200]}..." - - # Verify o3-pro was used - metadata = response_data["metadata"] - assert metadata["model_used"] == "o3-pro" - assert metadata["provider_used"] == "openai" - - print("✅ Verified o3-pro response with minimal fixture!") - - @pytest.mark.no_mock_provider - async def test_o3_pro_no_fixture_at_all(self, monkeypatch): - """Test that o3-pro works without any fixture - just inline API key.""" - cassette_path = cassette_dir / "o3_pro_basic_math.json" - - if not cassette_path.exists(): - pytest.skip("Cassette not found") - - # Set API key inline - no fixture needed! - monkeypatch.setenv("OPENAI_API_KEY", "dummy-key-for-replay") - - # Simplified transport injection - just one line! - inject_transport(monkeypatch, cassette_path) - - # Execute test - chat_tool = ChatTool() - arguments = {"prompt": "What is 2 + 2?", "model": "o3-pro", "temperature": 1.0} - - result = await chat_tool.execute(arguments) - assert result is not None - - print("✅ Test works without any fixture - just inline API key!")