-
-
Notifications
You must be signed in to change notification settings - Fork 541
parallel invocation of tox environments #439 #1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
494b147
implement parallel invocation of tox environments #439
gaborbernat 8a1567b
report failed environments output
gaborbernat f4ddfb2
allow to control degree of parallel similar to pytest-xdist
gaborbernat aa944ac
Add progress spinner to parallel and dependencies
gaborbernat c008a2c
Document parallel mode
gaborbernat 36c6cab
expose detox as a tox -p all
gaborbernat 958c94b
fix upload, report in Azure
gaborbernat 406a565
add spinner
gaborbernat 726bab5
try improve tests
gaborbernat f15f9cc
fix spinner tests
gaborbernat 529f978
add graph tests
gaborbernat a660045
stable order for the spinner
gaborbernat 70b3cbe
stable order for the graph circle detection
gaborbernat 95bc123
Windows has no atty cursor disable control characters
gaborbernat 78488da
default auto for detox
gaborbernat c0c35c3
use != for string comparision
gaborbernat 9661832
move changelog documentation into the main documentation, note depend…
gaborbernat af84b54
explicitly set expected for spinner tests
gaborbernat 917e24a
add test that spinner works in background
gaborbernat 3ccf390
declare unicode files
gaborbernat 1092d6e
tests for parallel with dependencies and parallel config
gaborbernat d0de9ab
add detox test
gaborbernat bbdb6a3
no cover for exoteric process getters
gaborbernat 2a965aa
colors to report
gaborbernat 7b97d3a
Merge branch 'master' into parallel
gaborbernat 0da3bc7
remove detox alias :-) as it does not adhere to detox interface
gaborbernat 2ea0546
use isolated build for parallel tests
gaborbernat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Parallel mode added (alternative to ``detox`` which is being deprecated), for more details see :ref:`parallel_mode` - by :user:`gaborbernat`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
from argparse import ArgumentTypeError | ||
|
||
ENV_VAR_KEY = "TOX_PARALLEL_ENV" | ||
OFF_VALUE = 0 | ||
DEFAULT_PARALLEL = OFF_VALUE | ||
|
||
|
||
def auto_detect_cpus(): | ||
try: | ||
from os import sched_getaffinity # python 3 only | ||
|
||
def cpu_count(): | ||
return len(sched_getaffinity(0)) | ||
|
||
except ImportError: | ||
# python 2 options | ||
try: | ||
from os import cpu_count | ||
except ImportError: | ||
from multiprocessing import cpu_count | ||
|
||
try: | ||
n = cpu_count() | ||
except NotImplementedError: # pragma: no cov | ||
n = None # pragma: no cov | ||
return n if n else 1 | ||
|
||
|
||
def parse_num_processes(s): | ||
if s == "all": | ||
return None | ||
if s == "auto": | ||
return auto_detect_cpus() | ||
else: | ||
value = int(s) | ||
if value < 0: | ||
raise ArgumentTypeError("value must be positive") | ||
return value | ||
|
||
|
||
def add_parallel_flags(parser): | ||
parser.add_argument( | ||
"-p", | ||
"--parallel", | ||
dest="parallel", | ||
help="run tox environments in parallel, the argument controls limit: all," | ||
" auto - cpu count, some positive number, zero is turn off", | ||
action="store", | ||
type=parse_num_processes, | ||
default=DEFAULT_PARALLEL, | ||
metavar="VAL", | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--parallel-live", | ||
action="store_true", | ||
dest="parallel_live", | ||
help="connect to stdout while running environments", | ||
) | ||
|
||
|
||
def add_parallel_config(parser): | ||
parser.add_testenv_attribute( | ||
"depends", | ||
type="env-list", | ||
help="tox environments that this environment depends on (must be run after those)", | ||
) | ||
|
||
parser.add_testenv_attribute( | ||
"parallel_show_output", | ||
type="bool", | ||
default=False, | ||
help="if set to True the content of the output will always be shown " | ||
"when running in parallel mode", | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.