-
-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invoke test runner at a more granular level for pypy shard. (#513)
Fixes #497
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 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 |
---|---|---|
|
@@ -77,4 +77,4 @@ install: | |
- pip install -U tox "setuptools<34" | ||
|
||
script: | ||
- tox -v | ||
- ./scripts/ci.sh |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [[ "$TOXENV" == "pypy" ]]; then | ||
echo "pypy shard detected. invoking workaround for https://github.com/travis-ci/travis-ci/issues/9706" | ||
tox -e list-tests | grep ^"RUNNABLE" | grep -v "tests/test_integration.py" | awk -F'\t' '{print $NF}' | xargs -L1 tox -v | ||
else | ||
tox -v | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import pytest | ||
|
||
|
||
class Collector(object): | ||
|
||
RUN_INDIVIDUALLY = ['tests/test_pex.py'] | ||
|
||
def __init__(self): | ||
self._collected = set() | ||
|
||
def iter_collected(self): | ||
for collected in sorted(self._collected): | ||
yield collected | ||
|
||
def pytest_collectreport(self, report): | ||
if report.failed: | ||
raise pytest.UsageError('Errors during collection, aborting!') | ||
|
||
def pytest_collection_modifyitems(self, items): | ||
for item in items: | ||
test_file = item.location[0] | ||
if test_file in self.RUN_INDIVIDUALLY: | ||
self._collected.add(item.nodeid) | ||
else: | ||
self._collected.add(test_file) | ||
|
||
|
||
collector = Collector() | ||
rv = pytest.main(['--collect-only'] + sys.argv[1:], plugins=[collector]) | ||
|
||
for test_target in collector.iter_collected(): | ||
print('RUNNABLE\t"{}"'.format(test_target)) | ||
|
||
sys.exit(rv) |
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