Skip to content

Commit 94c1425

Browse files
Implemented a load scheduler that groups tests by scope.
1 parent f8e7d91 commit 94c1425

File tree

5 files changed

+443
-2
lines changed

5 files changed

+443
-2
lines changed

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
from sys import version_info
2+
13
from setuptools import setup, find_packages
24

5+
install_requires = ['execnet>=1.1', 'pytest>=3.0.0']
6+
7+
if version_info < (2, 7):
8+
install_requires.append('ordereddict')
9+
10+
311
setup(
412
name="pytest-xdist",
513
use_scm_version={'write_to': 'xdist/_version.py'},
@@ -20,7 +28,7 @@
2028
],
2129
},
2230
zip_safe=False,
23-
install_requires=['execnet>=1.1', 'pytest>=3.0.0'],
31+
install_requires=install_requires,
2432
setup_requires=['setuptools_scm'],
2533
classifiers=[
2634
'Development Status :: 5 - Production/Stable',

xdist/dsession.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from xdist.scheduler import (
66
EachScheduling,
77
LoadScheduling,
8+
LoadScopeScheduling,
89
)
910

1011

@@ -97,6 +98,7 @@ def pytest_xdist_make_scheduler(self, config, log):
9798
schedulers = {
9899
'each': EachScheduling,
99100
'load': LoadScheduling,
101+
'loadscope': LoadScopeScheduling,
100102
}
101103
return schedulers[dist](config, log)
102104

xdist/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ def pytest_addoption(parser):
3131
"when crashed (set to zero to disable this feature)")
3232
group._addoption(
3333
'--dist', metavar="distmode",
34-
action="store", choices=['each', 'load', 'no'],
34+
action="store", choices=['each', 'load', 'loadscope', 'no'],
3535
dest="dist", default="no",
3636
help=("set mode for distributing tests to exec environments.\n\n"
3737
"each: send each test to all available environments.\n\n"
3838
"load: load balance by sending any pending test to any"
3939
" available environment.\n\n"
40+
"loadscope: load balance by sending pending groups of tests in"
41+
" the same scope to any available environment.\n\n"
4042
"(default) no: run tests inprocess, don't distribute."))
4143
group._addoption(
4244
'--tx', dest="tx", action="append", default=[],

xdist/scheduler/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from xdist.scheduler.each import EachScheduling # noqa
22
from xdist.scheduler.load import LoadScheduling # noqa
3+
from xdist.scheduler.loadscope import LoadScopeScheduling # noqa

0 commit comments

Comments
 (0)