Set dist=loadscope for pytest in pytest.ini

Previously there was some handling of old pytest-xdist versions which is
no longer needed.

(cherry picked from commit c47b076494)
This commit is contained in:
Štěpán Balážik 2026-01-28 01:03:10 +01:00
parent a8911683d7
commit 4f8d253d7a
2 changed files with 1 additions and 21 deletions

View file

@ -41,7 +41,6 @@ isctest.vars.init_vars()
# ----------------------- Globals definition -----------------------------
XDIST_WORKER = os.environ.get("PYTEST_XDIST_WORKER", "")
FILE_DIR = os.path.abspath(Path(__file__).parent)
ENV_RE = Re(b"([^=]+)=(.*)")
PRIORITY_TESTS = [
@ -73,25 +72,6 @@ def pytest_addoption(parser):
)
def pytest_configure(config):
# Ensure this hook only runs on the main pytest instance if xdist is
# used to spawn other workers.
if not XDIST_WORKER:
if config.pluginmanager.has_plugin("xdist") and config.option.numprocesses:
# system tests depend on module scope for setup & teardown
# enforce use "loadscope" scheduler or disable paralelism
try:
import xdist.scheduler.loadscope # pylint: disable=unused-import
except ImportError:
isctest.log.debug(
"xdist is too old and does not have "
"scheduler.loadscope, disabling parallelism"
)
config.option.dist = "no"
else:
config.option.dist = "loadscope"
def pytest_ignore_collect(collection_path):
# System tests are executed in temporary directories inside
# bin/tests/system. These temporary directories contain all files

View file

@ -10,7 +10,7 @@
# information regarding copyright ownership.
[pytest]
addopts = --tb=short -rA -vv
addopts = --tb=short -rA -vv --dist=loadscope
log_format = %(asctime)s %(levelname)s:%(name)s %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
log_cli = 1