[py-dev] py.test test function naming
Ian Bicking
ianb at colorstudy.com
Thu Feb 17 06:34:29 CET 2005
A note: when I was translating all my SQLObject tests into py.test, one
issue I found is that only functions starting in test_ are found, which
means functions (or rather methods) like testThis are ignored. This is
a problem, because that's the preferred style for unittest, and
unittest-based tests are otherwise not too hard to move over (make the
sure class name is properly named -- also a bit of a problem -- then get
rid of the superclass and turn setUp into setup_method and tearDown into
teardown_method).
The real problem here is that while other problems with the translation
are usually detectable (because a test fails, or syntax is incorrect or
something), this problem fails silently, in that a test just gets lost.
When converting a big project this is a problem. So that's a
long-winded way saying that really any method or function that starts
with "test" (no underscore) should be picked up.
--
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Pytest-dev
mailing list