diff --git a/autogpt_platform/backend/backend/blocks/mcp/conftest.py b/autogpt_platform/backend/backend/blocks/mcp/conftest.py index 80a4628354..7d40307427 100644 --- a/autogpt_platform/backend/backend/blocks/mcp/conftest.py +++ b/autogpt_platform/backend/backend/blocks/mcp/conftest.py @@ -9,6 +9,27 @@ full SpinTestServer infrastructure. import pytest +def pytest_configure(config: pytest.Config) -> None: + config.addinivalue_line("markers", "e2e: end-to-end tests requiring network") + + +def pytest_collection_modifyitems( + config: pytest.Config, items: list[pytest.Item] +) -> None: + """Skip e2e tests unless --run-e2e is passed.""" + if not config.getoption("--run-e2e", default=False): + skip_e2e = pytest.mark.skip(reason="need --run-e2e option to run") + for item in items: + if "e2e" in item.keywords: + item.add_marker(skip_e2e) + + +def pytest_addoption(parser: pytest.Parser) -> None: + parser.addoption( + "--run-e2e", action="store_true", default=False, help="run e2e tests" + ) + + @pytest.fixture(scope="session") def server(): """No-op override — MCP tests don't need the full platform server."""