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.
This commit is contained in:
Zamil Majdy
2026-02-09 10:14:35 +04:00
parent 7aab2eb1d5
commit e59e8dd9a9

View File

@@ -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."""