Skip to content

Commit

Permalink
docs: more description in balance_xdist_plugin.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Dec 11, 2021
1 parent 157053d commit dff1ff4
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/balance_xdist_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,26 @@
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt

"""
A pytest plugin to record test times and then balance xdist with them next time.
A pytest plugin to record test times and then use those times to divide tests
into evenly balanced workloads for each xdist worker.
Two things are hard-coded here that shouldn't be:
- The timing data is written to the tmp directory, but should use the pytest
cache (https://docs.pytest.org/en/latest/how-to/cache.html).
- The number of xdist workers is hard-coded to 8 because I couldn't figure out
how to find the number. Would it be crazy to read the -n argument directly?
You can force some tests to run on the same worker by setting the
`balanced_clumps` setting in your pytest config file. Each line is a substring
of a test name. All tests with that substring (like -k) will run on the
worker:
balanced_clumps =
LongRunningFixture
some_other_test_substring
The only thing in here particular to coverage.py is the use of the tmp directory
for storing the data.
"""

import collections
Expand Down

0 comments on commit dff1ff4

Please sign in to comment.