Skip to content

Commit

Permalink
Implemented a load scheduler that groups tests by scope.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-jenkins committed Jul 27, 2017
1 parent f8e7d91 commit 94c1425
Show file tree
Hide file tree
Showing 5 changed files with 443 additions and 2 deletions.
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
from sys import version_info

from setuptools import setup, find_packages

install_requires = ['execnet>=1.1', 'pytest>=3.0.0']

if version_info < (2, 7):
install_requires.append('ordereddict')


setup(
name="pytest-xdist",
use_scm_version={'write_to': 'xdist/_version.py'},
Expand All @@ -20,7 +28,7 @@
],
},
zip_safe=False,
install_requires=['execnet>=1.1', 'pytest>=3.0.0'],
install_requires=install_requires,
setup_requires=['setuptools_scm'],
classifiers=[
'Development Status :: 5 - Production/Stable',
Expand Down
2 changes: 2 additions & 0 deletions xdist/dsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from xdist.scheduler import (
EachScheduling,
LoadScheduling,
LoadScopeScheduling,
)


Expand Down Expand Up @@ -97,6 +98,7 @@ def pytest_xdist_make_scheduler(self, config, log):
schedulers = {
'each': EachScheduling,
'load': LoadScheduling,
'loadscope': LoadScopeScheduling,
}
return schedulers[dist](config, log)

Expand Down
4 changes: 3 additions & 1 deletion xdist/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ def pytest_addoption(parser):
"when crashed (set to zero to disable this feature)")
group._addoption(
'--dist', metavar="distmode",
action="store", choices=['each', 'load', 'no'],
action="store", choices=['each', 'load', 'loadscope', 'no'],
dest="dist", default="no",
help=("set mode for distributing tests to exec environments.\n\n"
"each: send each test to all available environments.\n\n"
"load: load balance by sending any pending test to any"
" available environment.\n\n"
"loadscope: load balance by sending pending groups of tests in"
" the same scope to any available environment.\n\n"
"(default) no: run tests inprocess, don't distribute."))
group._addoption(
'--tx', dest="tx", action="append", default=[],
Expand Down
1 change: 1 addition & 0 deletions xdist/scheduler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from xdist.scheduler.each import EachScheduling # noqa
from xdist.scheduler.load import LoadScheduling # noqa
from xdist.scheduler.loadscope import LoadScopeScheduling # noqa
Loading

0 comments on commit 94c1425

Please sign in to comment.