Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WORK-IN-PROGRESS - contributing isoscope scheduler #1126

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ repos:
- execnet>=2.1.0
- types-psutil
- setproctitle
- filelock>=3.13.1
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
pytest-xdist 3.ZZZ.ZZZ (2024-zz-zz)
===================================

Features
--------
- `#1126 <https://github.com/pytest-dev/pytest-xdist/pull/1126>`_: New ``isoscope`` scheduler.

pytest-xdist 3.6.1 (2024-04-28)
===============================

Expand Down
13 changes: 13 additions & 0 deletions docs/distribution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ The test distribution algorithm is configured with the ``--dist`` command-line o

.. _distribution modes:

* ``--dist isoscope``: Scope Isolation Scheduler. Tests are grouped by module for
test functions and by class for test methods. Tests are executed one group at a
time, distributed across available workers. This groupwise isolation guarantees
that all tests in one group complete execution before running another group of
tests. This can be useful when module-level or class-level fixtures of one group
could create undesirable side-effects for tests in other test groups, while
taking advantage of distributed execution of tests within each group. Grouping
by class takes priority over grouping by module. NOTE: the use of this scheduler
requires distributed coordination for setup and teardown such as provided by
the ``iso_scheduling`` fixture or an alternate implementation of distributed
coordination - see the ``iso_scheduling.coordinate_setup_teardown`` usage example
in iso_scheduling_plugin.py.

* ``--dist load`` **(default)**: Sends pending tests to any worker that is
available, without any guaranteed order. Scheduling can be fine-tuned with
the `--maxschedchunk` option, see output of `pytest --help`.
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ classifiers = [
requires-python = ">=3.8"
dependencies = [
"execnet>=2.1",
"filelock>=3.13.1",
"pytest>=7.0.0",
]
dynamic = ["version"]
Expand All @@ -47,6 +48,7 @@ Tracker = "https://github.com/pytest-dev/pytest-xdist/issues"

[project.entry-points.pytest11]
xdist = "xdist.plugin"
"xdist.iso_scheduling_plugin" = "xdist.iso_scheduling_plugin"
"xdist.looponfail" = "xdist.looponfail"

[project.optional-dependencies]
Expand Down
3 changes: 3 additions & 0 deletions src/xdist/dsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from xdist.remote import Producer
from xdist.remote import WorkerInfo
from xdist.scheduler import EachScheduling
from xdist.scheduler import IsoScopeScheduling
from xdist.scheduler import LoadFileScheduling
from xdist.scheduler import LoadGroupScheduling
from xdist.scheduler import LoadScheduling
Expand Down Expand Up @@ -113,6 +114,8 @@ def pytest_xdist_make_scheduler(
dist = config.getvalue("dist")
if dist == "each":
return EachScheduling(config, log)
if dist == "isoscope":
return IsoScopeScheduling(config, log)
if dist == "load":
return LoadScheduling(config, log)
if dist == "loadscope":
Expand Down
Loading