[TIP] testscenarios misuse or bug?

Darragh Bailey daragh.bailey at gmail.com
Tue Dec 15 14:00:34 PST 2015


Encountered an odd behaviour between testscenarios'
"TestWithScenarios" class in combination with fixtures and testtools.

I'm attempting to use TestWithScenarios to handle the scenarios
instead of a separate test function to do the exact same set up and
calls with just different inputs.

For failing tests I was making use of testtools' addOnException()
functionality since I'm also using fixtures.TempDir, part of gathering
information about a failure involves running a separate process in the
created temp directory.

However, for some reason the calls being made by addOnException()
appear to occur after the clean up call has been made on the fixture.
I was expecting the order to be addOnException then cleanUp.
In addition, even the working test appears to call the addOnException function.

I've no idea why, because using separate test functions to perform the
testing instead works as expected.

Instead of trying to explain via email, I've created a simple gist to
show an example of the issue I'm hitting.


Is there something I've missed? Or is this a bug in testscenarios?

Darragh Bailey
"Nothing is foolproof to a sufficiently talented fool"

More information about the testing-in-python mailing list