@@ -1528,7 +1528,14 @@ def tk_window_focus():
15281528 ]
15291529
15301530
1531- def verify_test_dependencies ():
1531+ def _init_tests ():
1532+ try :
1533+ import faulthandler
1534+ except ImportError :
1535+ pass
1536+ else :
1537+ faulthandler .enable ()
1538+
15321539 if not os .path .isdir (os .path .join (os .path .dirname (__file__ ), 'tests' )):
15331540 raise ImportError ("matplotlib test data is not installed" )
15341541
@@ -1563,37 +1570,36 @@ def verify_test_dependencies():
15631570 raise
15641571
15651572
1573+ def _get_extra_test_plugins ():
1574+ from .testing .noseclasses import KnownFailure
1575+ from nose .plugins import attrib
1576+
1577+ return [KnownFailure , attrib .Plugin ]
1578+
1579+
15661580def test (verbosity = 1 ):
15671581 """run the matplotlib test suite"""
1568- verify_test_dependencies ()
1569- try :
1570- import faulthandler
1571- except ImportError :
1572- pass
1573- else :
1574- faulthandler .enable ()
1582+ _init_tests ()
15751583
15761584 old_backend = rcParams ['backend' ]
15771585 try :
15781586 use ('agg' )
15791587 import nose
15801588 import nose .plugins .builtin
1581- from .testing .noseclasses import KnownFailure
15821589 from nose .plugins .manager import PluginManager
15831590 from nose .plugins import multiprocess
15841591
15851592 # store the old values before overriding
1586- plugins = []
1587- plugins .append (KnownFailure ())
1593+ plugins = _get_extra_test_plugins ()
15881594 plugins .extend ([plugin () for plugin in nose .plugins .builtin .plugins ])
15891595
1590- manager = PluginManager (plugins = plugins )
1596+ manager = PluginManager (plugins = [ x () for x in plugins ] )
15911597 config = nose .config .Config (verbosity = verbosity , plugins = manager )
15921598
15931599 # Nose doesn't automatically instantiate all of the plugins in the
15941600 # child processes, so we have to provide the multiprocess plugin with
15951601 # a list.
1596- multiprocess ._instantiate_plugins = [ KnownFailure ]
1602+ multiprocess ._instantiate_plugins = plugins
15971603
15981604 success = nose .run (
15991605 defaultTest = default_test_modules ,
0 commit comments