[TIP] unittest hook in addition to setUp and tearDown
robertc at robertcollins.net
Wed Nov 9 13:40:48 PST 2016
So, two things.
a) Don't use tearDown at all - its not guaranteed to run; use addCleanup.
b) You can include assertions in cleanups, and they will fail the test
when they file - but the other cleans will still run in FILO order.
On 10 November 2016 at 06:38, Dana Scott <danawscott0 at gmail.com> wrote:
> Is there a way to add a hook to a unittest.TestCase that would run after or
> during each test method, before tearDown, and affect the result? That is,
> I'd like it to contain an assert method that determines whether it passes or
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
More information about the testing-in-python