@@ -1487,7 +1487,14 @@ def tk_window_focus():
14871487 ]
14881488
14891489
1490- def verify_test_dependencies ():
1490+ def _init_tests ():
1491+ try :
1492+ import faulthandler
1493+ except ImportError :
1494+ pass
1495+ else :
1496+ faulthandler .enable ()
1497+
14911498 if not os .path .isdir (os .path .join (os .path .dirname (__file__ ), 'tests' )):
14921499 raise ImportError ("matplotlib test data is not installed" )
14931500
@@ -1502,28 +1509,27 @@ def verify_test_dependencies():
15021509 raise
15031510
15041511
1512+ def _get_extra_test_plugins ():
1513+ from .testing .noseclasses import KnownFailure
1514+ from nose .plugins import attrib
1515+
1516+ return [KnownFailure (), attrib .Plugin ()]
1517+
1518+
15051519def test (verbosity = 1 ):
15061520 """run the matplotlib test suite"""
1507- verify_test_dependencies ()
1508- try :
1509- import faulthandler
1510- except ImportError :
1511- pass
1512- else :
1513- faulthandler .enable ()
1521+ _init_tests ()
15141522
15151523 old_backend = rcParams ['backend' ]
15161524 try :
15171525 use ('agg' )
15181526 import nose
15191527 import nose .plugins .builtin
1520- from .testing .noseclasses import KnownFailure
15211528 from nose .plugins .manager import PluginManager
15221529 from nose .plugins import multiprocess
15231530
15241531 # store the old values before overriding
1525- plugins = []
1526- plugins .append (KnownFailure ())
1532+ plugins = _get_extra_test_plugins ()
15271533 plugins .extend ([plugin () for plugin in nose .plugins .builtin .plugins ])
15281534
15291535 manager = PluginManager (plugins = plugins )
@@ -1532,7 +1538,7 @@ def test(verbosity=1):
15321538 # Nose doesn't automatically instantiate all of the plugins in the
15331539 # child processes, so we have to provide the multiprocess plugin with
15341540 # a list.
1535- multiprocess ._instantiate_plugins = [ KnownFailure ]
1541+ multiprocess ._instantiate_plugins = plugins
15361542
15371543 success = nose .run (
15381544 defaultTest = default_test_modules ,
0 commit comments