How to do it...

The Python unit testing framework comes with what are called Fixtures.

Refer to the following URLs for a description of what a test fixture is:

What this means is that we can create setup() and teardown() unit testing methods so that the setup() method is called at the beginning before any single test is executed, and at the end of every single unit test, the teardown() method is called.

This fixture capability provides us with a very controlled environment in which we can run our unit tests. It is similar to using pre- and post-conditions.

Let's ...

Get Python GUI Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.