Skip to main content

pytest-xdist scheduler that runs some tests on dedicated workers. can significantly improve runtime by running long tests on separate workers.

Project description

Build Status Coverage

xdist-scheduling-exclusive

pytest-xdist scheduler that runs some tests on dedicated workers.

Can significantly improve runtime by running long tests on separate workers.

Also in conftest.py you can find handy reporting capabilities to see how tests were scheduled.

Installation

pip install xdist-scheduling-exclusive pytest-xdist

Usage

To integrate with your pytest setup, update conftest.py as follows:

from xdist_scheduling_exclusive import ExclusiveLoadScopeScheduling

def pytest_xdist_make_scheduler(config, log):
    """xdist-pytest hook to set scheduler."""
    return ExclusiveLoadScopeScheduling(config, log)

And place exclusive tests file exclusive_tests.txt in tests/resources/.

You can get the list with pytest's --durations option that also sort tests by execution time. Do not forget to clear execution time from the file - there should be only test node IDs. See example in this project tests/resources/exclusive_tests.txt.

Placing the slowest tests in exclusive_tests.txt will give you the most benefit.

Available Schedulers:

  • ExclusiveLoadScheduling Schedule tests from exclusive_tests.txt first and on dedicated nodes.
  • ExclusiveLoadFileScheduling: Place tests from exclusive_tests.txt to unique scopes. Other tests are grouped as in --dist loadfile: tests from the same file run on the same node.
  • ExclusiveLoadScopeScheduling: Schedule tests from exclusive_tests.txt first and on dedicated nodes. Other tests are grouped as in --dist loadfile: tests from the same file run on the same node.

Developers

Do not forget to run . ./activate.sh.

To see how tests were scheduled use something like

python -m pytest -n 4 --xdist-report -s

Scripts

make help

Coverage report

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdist_scheduling_exclusive-1.2.0.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page