[Numpy-svn] r5454 - trunk/numpy/testing

numpy-svn at scipy.org numpy-svn at scipy.org
Sat Jul 19 09:50:19 EDT 2008


Author: alan.mcintyre
Date: 2008-07-19 08:50:16 -0500 (Sat, 19 Jul 2008)
New Revision: 5454

Modified:
   trunk/numpy/testing/nosetester.py
Log:
Instead of importing nose plugins, use the existing list of classes that 
nose.plugins.builtins imports.
If --with-doctest is included in extra_argv, remove it and use the NumPy doctester 
instead.


Modified: trunk/numpy/testing/nosetester.py
===================================================================
--- trunk/numpy/testing/nosetester.py	2008-07-19 04:23:52 UTC (rev 5453)
+++ trunk/numpy/testing/nosetester.py	2008-07-19 13:50:16 UTC (rev 5454)
@@ -188,6 +188,12 @@
             label = ''
             doctests = True
 
+        # if doctests is in the extra args, remove it and set the doctest 
+        # flag so the NumPy doctester is used instead
+        if extra_argv and '--with-doctest' in extra_argv:
+            extra_argv.remove('--with-doctest')
+            doctests = True
+
         argv = self._test_argv(label, verbose, extra_argv)
         if doctests:
             argv += ['--with-numpydoctest']
@@ -231,15 +237,18 @@
         # reset doctest state on every run
         import doctest
         doctest.master = None
-        
-        import nose.plugins.builtin
+
+        # construct list of plugins, omitting the existing doctest plugin
+        import nose.plugins.builtin 
         from noseclasses import numpyDoctest
-        plugins = [numpyDoctest(), ]
-        for m, p in nose.plugins.builtin.builtins:
-            mod = __import__(m,globals(),{},[p])
-            plug = getattr(mod, p)
-            plugins.append(plug())
+        plugins = [numpyDoctest()]
+        for p in nose.plugins.builtin.plugins:
+            plug = p()
+            if plug.name == 'doctest':
+                continue
 
+            plugins.append(plug)
+
         t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins)
         return t.result
 




More information about the Numpy-svn mailing list