forked from matplotlib/matplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
executable file
·47 lines (40 loc) · 1.63 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
#
# This allows running the matplotlib tests from the command line: e.g.
#
# $ python tests.py -v -d
#
# The arguments are identical to the arguments accepted by nosetests.
#
# See https://nose.readthedocs.org/ for a detailed description of
# these options.
import sys
import argparse
if __name__ == '__main__':
from matplotlib import default_test_modules, test
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--no-pep8', action='store_true',
help='Run all tests except PEP8 testing')
parser.add_argument('--pep8', action='store_true',
help='Run only PEP8 testing')
parser.add_argument('--no-network', action='store_true',
help='Run tests without network connection')
parser.add_argument('-j', type=int,
help='Shortcut for specifying number of test processes')
args, extra_args = parser.parse_known_args()
if args.no_pep8:
default_test_modules.remove('matplotlib.tests.test_coding_standards')
elif args.pep8:
default_test_modules[:] = ['matplotlib.tests.test_coding_standards']
if args.no_network:
from matplotlib.testing import disable_internet
disable_internet.turn_off_internet()
extra_args.extend(['-a', '!network'])
if args.j:
extra_args.extend([
'--processes={}'.format(args.j),
'--process-timeout=300'
])
print('Python byte-compilation optimization level: %d' % sys.flags.optimize)
success = test(argv=sys.argv[0:1] + extra_args, switch_backend_warn=False)
sys.exit(not success)