summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2017-06-20 00:05:10 +1200
committerRalf Gommers <ralf.gommers@gmail.com>2017-06-21 18:09:51 +1200
commit9614b734452be6a0d6397f6ad03ff20058d4f41b (patch)
treef487b5e52349153d8c93b59ad94c34ca1806b0e1 /numpy
parentb7050a9732a46c52c3661b5b5869fbfdac1a39bd (diff)
downloadnumpy-9614b734452be6a0d6397f6ad03ff20058d4f41b.tar.gz
ENH: testing: load available nose plugins that are external to nose itself
Motivation is to be able to use `nose-timer` within the test() function. Try (after installing nose-timer): np.test(extra_argv=['--with-timer', '--timer-top-n', '20'])
Diffstat (limited to 'numpy')
-rw-r--r--numpy/testing/nosetester.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py
index 3d9616ed8..ee807fa67 100644
--- a/numpy/testing/nosetester.py
+++ b/numpy/testing/nosetester.py
@@ -274,11 +274,22 @@ class NoseTester(object):
if coverage:
argv += ['--cover-package=%s' % self.package_name, '--with-coverage',
'--cover-tests', '--cover-erase']
+
# construct list of plugins
import nose.plugins.builtin
+ from nose.plugins import EntryPointPluginManager
from .noseclasses import KnownFailurePlugin, Unplugger
plugins = [KnownFailurePlugin()]
plugins += [p() for p in nose.plugins.builtin.plugins]
+ try:
+ # External plugins (like nose-timer)
+ entrypoint_manager = EntryPointPluginManager()
+ entrypoint_manager.loadPlugins()
+ plugins += [p for p in entrypoint_manager.plugins]
+ except ImportError:
+ # Relies on pkg_resources, not a hard dependency
+ pass
+
# add doctesting if required
doctest_argv = '--with-doctest' in argv
if doctests == False and doctest_argv: