[TIP] towards 1.0 / code URLS using py.test?
pete.forman at westerngeco.com
Mon Jan 28 03:56:06 PST 2008
holger krekel <holger at merlinux.de> writes:
> Feel free to also mail me your favourite annoyance or feature wish
I'd like to automagically run doctests within py.test. I understand
that text files can be so processed. What I currently use is this
form of manually maintained test file:
# todo: test independently without importing all at once
import foo, test_bar, baz
assert doctest.testmod(foo) == 0
assert doctest.testmod(test_bar) == 0
assert doctest.testmod(baz) == 0
if __name__ == "__main__":
The way that I like to work is to use both doctest and py.test.
Doctest cases are simple examples to illustrate to users what my code
is doing. py.test cases are more comprehensive covering edge cases,
etc. What is missing OOTB is for py.test to run doctests in addition
to the comprehensive tests.
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete.forman at westerngeco.com -./\.- the opinion of Schlumberger or
http://petef.port5.com -./\.- WesternGeco.
More information about the testing-in-python