I've written some doctest extensions to: - Generate a unitest (pyunit) test suite from a module with doctest tests. Each doc string containing one or more doctest tests becomes a test case. If a test fails, an error message is included in the unittest output that has the module file name and the approximate line number of the docstring containing the failed test formatted in a way understood by emacs error parsing. This is important. ;) - Debug doctest tests. Normally, doctest tests can't be debugged with pdb because, while they are running, doctest has taken over standard output. This tool extracts the tests in a doc string into a separate script and runs pdb on it. - Extract a doctest doc string into a script file. I think that these would be good additions to doctest and propose to add them, The current source can be found here: http://cvs.zope.org/Zope3/src/zope/testing/doctestunit.py?rev=HEAD&content-type=text/vnd.viewcvs-markup I ended up using a slightly different (and simpler) strategy for finding docstrings than doctest uses. This might be an issue. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (703) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org
Yes please! +1. This makes me want to use doctests again (as does Terence Way's contracts implementation). Another issue for me is that all these big docstrings obscure my code. Hmm.. if emacs could fold the tests and contracts parts, perhaps that would be the answer.
participants (2)
-
Jim Fulton
-
Simon Michael