Failing unittest Test cases
Paul Rubin
http
Tue Jan 10 16:49:17 EST 2006
skip at pobox.com writes:
> Got any ideas how that is to be accomplished short of jiggering the
> names so they sort in the order you want them to run?
How about with a decorator instead of the testFuncName convention,
i.e. instead of
def testJiggle(): # "test" in the func name means it's a test case
...
use:
@test
def jiggletest(): # nothing special about the name "jiggletest"
...
The hack of searching the module for functions with special names was
always a big kludge and now that Python has decorators, that seems
like a cleaner way to do it.
In the above example, the 'test' decorator would register the
decorated function with the test framework, say by appending it to a
list. That would make it trivial to run them in code order.
More information about the Python-list
mailing list