Message 85447 - Python tracker (original) (raw)

The main use case for addCleanup is resource allocation in tests. Why does this require clean ups to be executed before tearDown?

If your cleanup relies on something which has been set up during setUp and will be dropped during tearDown (a database connection, a temp dir, an ssh session, whatever), then the cleanup must be run before the teardown.