nose support for unittest style fixtures

I ran nosetests on the tests written for unittest from my unittest fixture post.
No surprises.
Nose supports unittest style fixtures:

  • module: setUpModule()/tearDownModule()
  • class: setUpClass()/tearDownClass()
  • around methods: setUp()/tearDown()
  • add cleanup functions: addCleanup() called from setUp() and from a test
  • skipping tests dynamically: testSkip() called from setUp()
  • error conditions: don’t run the test or the matching tearDown if setUp fails. This is true for module, class, and method fixtures.

Here’s the output. (error cases omitted).

See the post unittest fixture syntax and flow reference for the source and a discussion of unittest style fixtures.

I’m not posting the output for the error cases, mostly because it’s long and boring.
However, I did verify that the proper control flow in failure cases is upheld when unittest tests are run with nose.

Leave a Reply