topotests: ignore env for pytest --collect-only

`--collect-only` does not run any tests, so bypass env checks for it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2022-09-06 17:43:26 +02:00
parent dd57a2c78e
commit 3d80bd11aa

View File

@ -232,6 +232,9 @@ def pytest_configure(config):
Assert that the environment is correctly configured, and get extra config. Assert that the environment is correctly configured, and get extra config.
""" """
if config.getoption("--collect-only"):
return
if "PYTEST_XDIST_WORKER" not in os.environ: if "PYTEST_XDIST_WORKER" not in os.environ:
os.environ["PYTEST_XDIST_MODE"] = config.getoption("dist", "no") os.environ["PYTEST_XDIST_MODE"] = config.getoption("dist", "no")
os.environ["PYTEST_TOPOTEST_WORKER"] = "" os.environ["PYTEST_TOPOTEST_WORKER"] = ""