[TIP] using py.test's setup_class with unittest tests?
hnsbstn at gmail.com
Tue Nov 23 09:46:21 PST 2010
Hello testing in python members,
I need some help related to py.test and unittest. I have tests written and
run using unittest and now I also want py.test to be able to run it. The
problem is at the beginning of each suite in a test script there is a setup
that needs to be done. I need this setup function to be called as well when
run with py.test.
To illustrate my problem, I have a test script below and my goal is to be
able to run custom_setup() when run with unittest or py.test. The problem is
setup_class is not getting called. We use python 2.6.4 and py-1.2.1. Can
this be done? Thank you.
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSimple)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python