From 6fa7cbcf0d7f2ef0fe53e2de74e2d4ea36b76c26 Mon Sep 17 00:00:00 2001 From: Josh Vera Date: Sun, 13 Jul 2025 11:29:02 -0600 Subject: [PATCH] fix: Ensure dummy API keys are set for tests with no_mock_provider marker The test failures in CI were caused by tests with @pytest.mark.no_mock_provider that prevented dummy API keys from being set. In CI with no real API keys, this led to 'Model not available' errors. Changed pytest_collection_modifyitems to always set dummy keys if missing, regardless of markers. This ensures tests work in CI while still allowing real API keys to be used when present. Fixes test_conversation_field_mapping.py failures in CI across Python 3.10-3.12. --- tests/conftest.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0c4775a..77af58a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -88,15 +88,9 @@ def pytest_configure(config): def pytest_collection_modifyitems(session, config, items): """Hook that runs after test collection to check for no_mock_provider markers.""" - # Check if any test has the no_mock_provider marker - for item in items: - if item.get_closest_marker("no_mock_provider"): - config._needs_dummy_keys = False - break - - # Set dummy keys only if no test needs real keys - if config._needs_dummy_keys: - _set_dummy_keys_if_missing() + # Always set dummy keys if real keys are missing + # This ensures tests work in CI even with no_mock_provider marker + _set_dummy_keys_if_missing() @pytest.fixture(autouse=True)