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') sys.argv.remove('--no-pep8') elif args.pep8: default_test_modules[:] = ['matplotlib.tests.test_coding_standards'] sys.argv.remove('--pep8') if args.no_network: from matplotlib.testing import disable_internet disable_internet.turn_off_internet() extra_args.extend(['-a', '!network']) sys.argv.remove('--no-network') if args.j: extra_args.extend( ['--processes={}'.format(args.j), '--process-timeout=300']) sys.argv.pop(sys.argv.index('-j') + 1) sys.argv.remove('-j') print('Python byte-compilation optimization level: %d' % sys.flags.optimize) success = test(argv=sys.argv + extra_args, switch_backend_warn=False) sys.exit(not success)
import warnings # Python 3.6 deprecate invalid character-pairs \A, \* ... in non # raw-strings and other things. Let's not re-introduce them warnings.filterwarnings('error', '.*invalid escape sequence.*', category=DeprecationWarning) warnings.filterwarnings( 'default', '.*inspect.getargspec\(\) is deprecated.*', category=DeprecationWarning) from matplotlib import test parser = argparse.ArgumentParser(add_help=False) parser.add_argument('--no-network', action='store_true', help='Run tests without network connection') parser.add_argument('--recursionlimit', type=int, default=0, help='Specify recursionlimit for test run') args, extra_args = parser.parse_known_args() if args.no_network: from matplotlib.testing import disable_internet disable_internet.turn_off_internet() extra_args.extend(['-m', 'not network']) print('Python byte-compilation optimization level:', sys.flags.optimize) retcode = test(argv=extra_args, switch_backend_warn=False, recursionlimit=args.recursionlimit) sys.exit(retcode)