Skip to content

Commit 8beb3df

Browse files
committed
Fix double running of explicitly chosen tests.
Running `python tests.py matplotlib.tests....` would run the chosen tests twice, causing errors when figures were closed from the first run and then missing in the second run. This is because `sys.argv + extra_args` produces the test list twice.
1 parent 67cf8d2 commit 8beb3df

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

tests.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,19 @@
2929

3030
if args.no_pep8:
3131
default_test_modules.remove('matplotlib.tests.test_coding_standards')
32-
sys.argv.remove('--no-pep8')
3332
elif args.pep8:
3433
default_test_modules[:] = ['matplotlib.tests.test_coding_standards']
35-
sys.argv.remove('--pep8')
3634
if args.no_network:
3735
from matplotlib.testing import disable_internet
3836
disable_internet.turn_off_internet()
3937
extra_args.extend(['-a', '!network'])
40-
sys.argv.remove('--no-network')
4138
if args.j:
4239
extra_args.extend([
4340
'--processes={}'.format(args.j),
4441
'--process-timeout=300'
4542
])
46-
sys.argv.pop(sys.argv.index('-j') + 1)
47-
sys.argv.remove('-j')
4843

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

51-
success = test(argv=sys.argv + extra_args, switch_backend_warn=False)
46+
success = test(argv=sys.argv[0:1] + extra_args, switch_backend_warn=False)
5247
sys.exit(not success)

0 commit comments

Comments
 (0)