test: give the argument-less pytest run the e2e-excluding configuration

CI runs the suite through `just test` -> `just unit`, i.e. `pytest` with
no path argument and the repository root as rootdir — which does not load
tests/pytest.ini, so its `addopts = -m "not e2e"` never applied there. The
e2e tests were collected and executed on every CI run and only stayed
green because a runner has no ~/GNS3/images directory: the harness skips
itself. A local run on a machine that does have images went ahead and
booted real servers for twelve minutes instead.

Declare the same policy in pyproject.toml, the file that argument-less
run does resolve, and add testpaths so the package-internal tests
(gns3server/agent/.../tests/) stay collected — `pytest tests` never
reached them either. That shape keeps resolving tests/pytest.ini and is
unchanged.
This commit is contained in:
YueGuobin 2026-10-02 00:31:57 +08:00
parent 90bcb32473
commit d6851695cc
No known key found for this signature in database

View File

@ -57,6 +57,23 @@ gns3server-uninstall-ai-features = "gns3server.utils.uninstall_ai_features:main"
packages = ["gns3server"]
[tool.pytest.ini_options]
# The configuration a root-level, argument-less `pytest` (what CI runs via
# `just test` -> `just unit`) resolves to. It must match tests/pytest.ini's
# e2e policy: live end-to-end tests are excluded by marker, not left to the
# harness's images-directory skip. Without this, the root run collected the
# e2e tests and only stayed green because CI machines happen to have no
# images directory. testpaths also keeps the package-internal tests under
# gns3server/ collected (an argument-less run picks up everything; a
# `pytest tests` run never did).
testpaths = ["tests", "gns3server"]
addopts = ["-m", "not e2e"]
markers = [
"e2e: live end-to-end tests (real server, kernel interfaces, emulators)",
]
asyncio_default_fixture_loop_scope = "function"
[tool.ruff]
target-version = "py310"
line-length = 120