A D V E R T I S E M E N T
Re-using Old Test Code with PyUnit
Some users will find that they have existing test code that they would
to run from PyUnit, without converting every old test function to a
For this reason, PyUnit provides a
TestCase can be used to wrap an existing test function.
Set-up and tear-down functions can also optionally be wrapped.
Given the following test function:
something = makeSomething()
assert something.name is not None
one can create an equivalent test case instance as follows:
testcase = unittest.FunctionTestCase(testSomething)
If there are additional set-up and tear-down methods that should be called as
part of the test case's operation, they can also be provided:
testcase = unittest.FunctionTestCase(testSomething,