This repository has been archived by the owner on Apr 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an attempt to fix #45 It does the following: * uses pytest-xdist to paralellize the tests (3 workers) * utilizes custom scheduler that splits the tests according to the fixture name * this is needed not to use 1 fixture on multiple workers see pytest-dev/pytest-xdist#18 * use parametrize an all integration tests to enable our hackish scheduler * mock now creates the roots in pwd (not to pollute the filesystem on /) * note that the roots can take several GBs
- Loading branch information
Showing
5 changed files
with
86 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ __pycache__ | |
/artifacts-*/ | ||
/build/ | ||
/dist/ | ||
/mockroots/ | ||
/.tox/ | ||
/.eggs/ | ||
.cache | ||
|
This file contains 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 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 |
---|---|---|
@@ -1,4 +1,22 @@ | ||
from xdist.scheduler import LoadScopeScheduling | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption('--fake', action='store_true', default=False, | ||
help='don\'t run the code, reuse the result from ' | ||
'last tests') | ||
|
||
|
||
class FixtureScheduling(LoadScopeScheduling): | ||
"""Split by [] value. This is very hackish and might blow up any time! | ||
See https://github.com/pytest-dev/pytest-xdist/issues/18 | ||
""" | ||
def _split_scope(self, nodeid): | ||
if '[' in nodeid: | ||
parameters = nodeid.rsplit('[')[-1].replace(']', '') | ||
return parameters.split('-')[0] | ||
return None | ||
|
||
|
||
def pytest_xdist_make_scheduler(log, config): | ||
return FixtureScheduling(config, log) |
This file contains 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 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