I ran nosetests on the tests written for unittest from my unittest fixture post.
Nose supports unittest style fixtures:
In unittest fixture syntax and flow reference, I only presented fixture methods and functions that threw no exceptions.
However, in real production code, it is entirely possible for something to go wrong when setting up test fixtures.
This post is simply do demonstrate exactly what happens to the flow of your test code when an exception is thrown in a fixture function.
And, while I’m at it, I may as well demo the normal control flow when a test fails, asserts, or throws an exception.
This post contains examples of how unittest test fixture functions and methods are written, and in what order they run. It may seem like a long post, but it’s mostly code examples and example output.
I want this to be a useful reference for both the syntax and flow of unittest fixtures.
If I missed something, please comment below, and I’ll update the post.