Skip to content

Commit

Permalink
Integrate isoscope scheduling and distributed sccope isolation into x…
Browse files Browse the repository at this point in the history
…dist. Not tested yet.
  • Loading branch information
Vitaly Kruglikov committed Sep 6, 2024
1 parent 7c5a664 commit 0c95b78
Show file tree
Hide file tree
Showing 9 changed files with 220 additions and 148 deletions.
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

0 comments on commit 0c95b78

Please sign in to comment.