[Numpy-discussion] Error for numpy.test() with doctest environment configs

Matthew Brett matthew.brett@gmail....
Thu Dec 24 11:50:39 CST 2009


Hi,

Because I like doctests, I have the following set in my .noserc file:

with-doctest=1

This setting breaks numpy.test() like this:

In [2]: numpy.test()
Running unit tests for numpy
NumPy version 1.5.0.dev8029
NumPy is installed in /Users/mb312/usr/local/lib/python2.6/site-packages/numpy
Python version 2.6.4 (r264:75706, Dec 22 2009, 14:55:30) [GCC 4.2.1
(Apple Inc. build 5646) (dot 1)]
nose version 0.11.1
------------------------------------------------------------
Traceback (most recent call last):
 File "<ipython console>", line 1, in <module>
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/numpy/testing/nosetester.py",
line 335, in test
   t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins)
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg/nose/core.py",
line 113, in __init__
   argv=argv, testRunner=testRunner, testLoader=testLoader)
 File "/Users/mb312/usr/local/lib/python2.6/unittest.py", line 816, in __init__
   self.parseArgs(argv)
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg/nose/core.py",
line 130, in parseArgs
   self.config.configure(argv, doc=self.usage())
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg/nose/config.py",
line 249, in configure
   options, args = self._parseArgs(argv, cfg_files)
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg/nose/config.py",
line 237, in _parseArgs
   return parser.parseArgsAndConfigFiles(argv[1:], cfg_files)
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg/nose/config.py",
line 132, in parseArgsAndConfigFiles
   self._applyConfigurationToValues(self._parser, config, values)
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg/nose/config.py",
line 118, in _applyConfigurationToValues
   name=name, filename=filename)
 File "/Users/mb312/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg/nose/config.py",
line 234, in warn_sometimes
   raise ConfigError(msg)
ConfigError: Error reading config file '/Users/mb312/.noserc': no such
option 'with-doctest'

The reason for this is that, in the numpy testing machinery
(nostester.py, around line 249, the 'doctest' plugin is pulled out of
the plugins list, because we prefer our own numpy doctest tester.
Accordingly, when we initialize our noseclasses.NumpyTestProgram, the
'doctest' plugin is not present, and therefore cannot parse any of its
configuration, and hence the error.

An obvious idea is to allow the testing machinery to parse all
the configs, including the doctest configs, then throw away the native
(non-numpy) doctest plugin before we get to collecting and running the
tests.

I've attached a patch that does this; it's a little bit magic because
of the class structure of nose, but I hope it makes sense.   I'd be
very grateful for a review,

Thanks a lot,

Matthew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nose_plugin_workaround
Type: application/octet-stream
Size: 3310 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20091224/63ac3c36/attachment-0001.obj 


More information about the NumPy-Discussion mailing list