From d6851695cc23779bc3008ab962946becfa5fcdb1 Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Fri, 2 Oct 2026 00:31:57 +0800 Subject: [PATCH] test: give the argument-less pytest run the e2e-excluding configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pyproject.toml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 696d785a8..65c67d1bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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