I want a doctest like this:

     >>> from __future__ import division
     >>> 5/2
     2.5

This doesn't work, because in doctests each line is executed
separately, so when it comes to 5/2, the __future__ import is
forgotten, and 5/2 returns 2. I could use testcode blocks, but in
testcode blocks, I can't use ">>> " And I want to, because otherwise
it's hard to distinguish the code and the result.

I got around that with writing my own doctest parser with a special
case for this. But that mean I don't use the sphinx-build. So far so
good.

But then I have some code which I want to test, but I don't want the
test output to be in the output. I also in this case doesn't need the
>>> prompts. Well, it's a perfect case for a testcode block with a
testoutput :hide: block, right? But, since I don't use sphinx-build -b
doctests, those blocks are ignored by the normal testrunner.


So. I want either to get a normal unittest.TextTestRunner().run(suite)
to include the testcode blocks, *or* I need to override the testparser
for sphinx. Any recommendations for how to do this? Looking into how
sphinx.ext.doctest works, I believe the first option is
hellacomplicated. Is there a way for the second one?

-- 
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64

--

You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-...@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.


Reply via email to