From e59e8dd9a9fde47d5c1bedb8e9bf3f2df773d100 Mon Sep 17 00:00:00 2001 From: Zamil Majdy Date: Mon, 9 Feb 2026 10:14:35 +0400 Subject: [PATCH] fix(mcp): Skip e2e tests in CI unless --run-e2e is passed E2e tests hit a real external MCP server and are inherently flaky. Skip them by default, require --run-e2e flag to opt in. --- .../backend/backend/blocks/mcp/conftest.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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."""