Search code examples
pythonseleniumnoseteststeardown

Implementing tearDownClass functionality in Python 2.6


I've implemented a "global" setUp() for multiple tests inside my class.

Now I would like to know how to make a "global" teardown() function which will be run after the last test has finished, similar to tearDownClass() in Python > 2.7

If the information helps: I'm using nosetests.


Solution

  • How about using unittest2?

    unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7. It is tested to run on Python 2.4 - 2.7.

    ...

    New features include:

    • class and module level fixtures: setUpClass, tearDownClass, setUpModule, tearDownModule