Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6b175a

Browse files
committed
reintroduce tests.py for running tests on subselections
1 parent 9f9d5dd commit d6b175a

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

tests.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python
2+
#
3+
# This allows running the matplotlib tests from the command line: e.g.
4+
#
5+
# $ python tests.py -v -d
6+
#
7+
# The arguments are identical to the arguments accepted by nosetests.
8+
#
9+
# See https://nose.readthedocs.org/ for a detailed description of
10+
# these options.
11+
12+
import os
13+
import sys
14+
import time
15+
16+
import matplotlib
17+
matplotlib.use('agg')
18+
19+
import nose
20+
from matplotlib.testing.noseclasses import KnownFailure
21+
from matplotlib import default_test_modules
22+
23+
from matplotlib import font_manager
24+
# Make sure the font caches are created before starting any possibly
25+
# parallel tests
26+
if font_manager._fmcache is not None:
27+
while not os.path.exists(font_manager._fmcache):
28+
time.sleep(0.5)
29+
30+
plugins = [KnownFailure]
31+
32+
# Nose doesn't automatically instantiate all of the plugins in the
33+
# child processes, so we have to provide the multiprocess plugin with
34+
# a list.
35+
from nose.plugins import multiprocess
36+
multiprocess._instantiate_plugins = plugins
37+
38+
39+
def run():
40+
try:
41+
import faulthandler
42+
except ImportError:
43+
pass
44+
else:
45+
faulthandler.enable()
46+
47+
nose.main(addplugins=[x() for x in plugins],
48+
defaultTest=default_test_modules)
49+
50+
if __name__ == '__main__':
51+
if '--no-pep8' in sys.argv:
52+
default_test_modules.remove('matplotlib.tests.test_coding_standards')
53+
sys.argv.remove('--no-pep8')
54+
elif '--pep8' in sys.argv:
55+
default_test_modules = ['matplotlib.tests.test_coding_standards']
56+
sys.argv.remove('--pep8')
57+
58+
run()

0 commit comments

Comments
 (0)