8000 Merge pull request #7362 from bcongdon/multi-process-flag · matplotlib/matplotlib@3e89069 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e89069

Browse files
authored
Merge pull request #7362 from bcongdon/multi-process-flag
Added `-j` shortcut for `--processes=`
2 parents d7b8992 + 7f29efe commit 3e89069

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ env:
4444
- PANDAS=
4545
- NPROC=2
4646
- TEST_ARGS=--no-pep8
47-
- NOSE_ARGS="--processes=$NPROC --process-timeout=300"
47+
- NOSE_ARGS="-j $NPROC"
4848
- PYTEST_ARGS="-ra --timeout=300 --durations=25 --cov-report= --cov=lib" # -n $NPROC
4949
- PYTHON_ARGS=
5050
- DELETE_FONT_CACHE=

tests.py

Lines changed: 21 additions & 4 deletions
22
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,41 @@
1010
# these options.
1111

1212
import sys
13+
import argparse
1314

1415

1516
if __name__ == '__main__':
1617
from matplotlib import default_test_modules, test
1718

18-
extra_args = []
19+
parser = argparse.ArgumentParser(add_help=False)
20+
parser.add_argument('--no-pep8', action='store_true',
21+
help='Run all tests except PEP8 testing')
22+
parser.add_argument('--pep8', action='store_true',
23+
help='Run only PEP8 testing')
24+
parser.add_argument('--no-network', action='store_true',
25+
help='Run tests without network connection')
26+
parser.add_argument('-j', type=int,
27+
help='Shortcut for specifying number of test processes')
28+
args, extra_args = parser.parse_known_args()
1929

20-
if '--no-pep8' in sys.argv:
30+
if args.no_pep8:
2131
default_test_modules.remove('matplotlib.tests.test_coding_standards')
32
sys.argv.remove('--no-pep8')
23-
elif '--pep8' in sys.argv:
33+
elif args.pep8:
2434
default_test_modules[:] = ['matplotlib.tests.test_coding_standards']
2535
sys.argv.remove('--pep8')
26-
if '--no-network' in sys.argv:
36+
if args.no_network:
2737
from matplotlib.testing import disable_internet
2838
disable_internet.turn_off_internet()
2939
extra_args.extend(['-a', '!network'])
3040
sys.argv.remove('--no-network')
41+
if args.j:
42+
extra_args.extend([
43+
'--processes={}'.format(args.j),
44+
'--process-timeout=300'
45+
])
46+
sys.argv.pop(sys.argv.index('-j') + 1)
47+
sys.argv.remove('-j')
3148

3249
print('Python byte-compilation optimization level: %d' % sys.flags.optimize)
3350

0 commit comments

Comments
 (0)
0