[TIP] doctest fixtures in nose

Barry Warsaw barry at python.org
Mon Jan 7 08:35:43 PST 2013


nose is great, and its support for doctests is pretty good.

However, I'd like to improve one aspect of doctest support, namely fixtures.
The doctest plugin has this option:

--doctest-fixtures=SUFFIX
    Find fixtures for a doctest file in module with this name appended to the
    base name of the doctest file

This doesn't work so well when you have one generic fixture for a few hundred
doctests. ;)

I opened this issue in nose's tracker:

https://github.com/nose-devs/nose/issues/594

and my thoughts were to add a --doctest-fixture (singular) option which would
name a module using dotted-notation that would be the generic fixture.  So
e.g. I could add:

--doctest-fixture=mypackage.subpkg.testing.doctest_fixture

and nose would import that module as the fixture (i.e. it would be on
sys.path).  I suggest allowing --doctest-fixtures (plural) to still allow for
overriding doctest fixtures on a per-doctest basis.

Thoughts?

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130107/4559b792/attachment.pgp>


More information about the testing-in-python mailing list