|
4 | 4 | # |
5 | 5 | # $ python tests.py -v -d |
6 | 6 | # |
7 | | -# The arguments are identical to the arguments accepted by nosetests. |
| 7 | +# The arguments are identical to the arguments accepted by py.test. |
8 | 8 | # |
9 | | -# See https://nose.readthedocs.org/ for a detailed description of |
10 | | -# these options. |
| 9 | +# See http://doc.pytest.org/ for a detailed description of these options. |
11 | 10 |
|
12 | 11 | import sys |
13 | 12 | import argparse |
|
39 | 38 | from matplotlib import test |
40 | 39 |
|
41 | 40 | parser = argparse.ArgumentParser(add_help=False) |
42 | | - parser.add_argument('--no-pep8', action='store_true', |
43 | | - help='Run all tests except PEP8 testing') |
44 | | - parser.add_argument('--pep8', action='store_true', |
45 | | - help='Run only PEP8 testing') |
46 | 41 | parser.add_argument('--no-network', action='store_true', |
47 | 42 | help='Run tests without network connection') |
48 | | - parser.add_argument('-j', type=int, |
49 | | - help='Shortcut for specifying number of test processes') |
50 | 43 | parser.add_argument('--recursionlimit', type=int, default=0, |
51 | 44 | help='Specify recursionlimit for test run') |
52 | 45 | args, extra_args = parser.parse_known_args() |
53 | 46 |
|
54 | 47 | if args.no_network: |
55 | 48 | from matplotlib.testing import disable_internet |
56 | 49 | disable_internet.turn_off_internet() |
57 | | - extra_args.extend(['-a', '!network']) |
58 | | - if args.j: |
59 | | - extra_args.extend([ |
60 | | - '--processes={}'.format(args.j), |
61 | | - '--process-timeout=300' |
62 | | - ]) |
| 50 | + extra_args.extend(['-m', 'not network']) |
63 | 51 |
|
64 | | - print('Python byte-compilation optimization level: %d' % sys.flags.optimize) |
| 52 | + print('Python byte-compilation optimization level:', sys.flags.optimize) |
65 | 53 |
|
66 | | - success = test(argv=sys.argv[0:1] + extra_args, switch_backend_warn=False, |
| 54 | + retcode = test(argv=extra_args, switch_backend_warn=False, |
67 | 55 | recursionlimit=args.recursionlimit) |
68 | | - sys.exit(not success) |
| 56 | + sys.exit(retcode) |
0 commit comments