[TIP] Is it kosher to subclass plugins?

Fernando Perez fperez.net at gmail.com
Sat Jun 21 13:32:24 PDT 2008


Howdy,

in my mumbling fight with getting extension modules properly doctested
(cf. http://code.google.com/p/python-nose/issues/detail?id=195 I just
submitted), I'm trying to write a doctests-derived plugin that will
work for numpy/scipy/ipython.  In an attempt to modify as little as
possible, I'm trying to subclass the nose doctest plugin, but when I
use my plugin that starts as:

class IPythonDoctestPlugin(doctests.Doctest):
    """Nose Plugin that supports IPython doctests.
    """
    name = 'ipdoctest'   # call nosetests with --with-ipdoctest
    enabled = True

... etc.

I get:

tlon[primes]> nosetests --with-ipdoctest --doctest-tests --exe primes
/var/lib/python-support/python2.5/nose/plugins/base.py:56:
RuntimeWarning: Plugin <nose.plugins.doctests.Doctest object at
0x843564c> has conflicting option string: option --doctest-tests:
conflicting option string(s): --doctest-tests and will be disabled
  "be disabled" % (self, e), RuntimeWarning)
Doctest: primes.primes ... ok

----------------------------------------------------------------------
Ran 1 test in 0.007s

OK

So the plugin seems to be working (the doctest in question *is* run
correctly), but I'm wondering about that 'conflicting option' message.
 Am I misusing something?  I can provide my entire code if it will
help.

Thanks!

f



More information about the testing-in-python mailing list