diff --git a/tests/conftest.py b/tests/conftest.py index 0a81382aa..7ab9074fd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,7 @@ from pathlib import Path import notte_core +import pytest CONFIG_PATH = Path(__file__).parent / "test_notte_config.toml" notte_core.set_error_mode("developer") @@ -49,3 +50,9 @@ def pytest_generate_tests(metafunc): # Apply parameterization only if any matching arguments exist if params: metafunc.parametrize(",".join(params.keys()), [next(iter(params.values()))]) + + +@pytest.fixture +def require_notte_api_key(): + if os.getenv("NOTTE_API_KEY") is None: + pytest.skip("NOTTE_API_KEY is required for live Notte API tests") diff --git a/tests/sdk/test_list.py b/tests/sdk/test_list.py index 9a88c2d66..be0ff872a 100644 --- a/tests/sdk/test_list.py +++ b/tests/sdk/test_list.py @@ -2,7 +2,7 @@ from notte_sdk import NotteClient -def test_simple_listing(): +def test_simple_listing(require_notte_api_key): _ = load_dotenv() notte = NotteClient() diff --git a/tests/sdk/test_replay_frames.py b/tests/sdk/test_replay_frames.py index 2778e2f9f..f4626154c 100644 --- a/tests/sdk/test_replay_frames.py +++ b/tests/sdk/test_replay_frames.py @@ -6,7 +6,7 @@ import notte -def test_sdk_screenshots(): +def test_sdk_screenshots(require_notte_api_key): """Make sure everything is in bytes (and not base64 encoded), all in JPEG""" client = NotteClient() diff --git a/tests/sdk/test_validator.py b/tests/sdk/test_validator.py index 100777dfd..a218fc1f1 100644 --- a/tests/sdk/test_validator.py +++ b/tests/sdk/test_validator.py @@ -12,7 +12,7 @@ class Product(BaseModel): @pytest.mark.flaky(reruns=3, reruns_delay=2) -def test_validator_message_received(): +def test_validator_message_received(require_notte_api_key): """Test that validation failures are logged and agent can recover with a valid response.""" log_buffer = io.StringIO() _ = logger.add(log_buffer, format="{message}")