I am trying to execute post-failure operations; so I can gather info on the state of the system only if it fail.
So far, I did not find a solution that works. I did try to add a try-except and this works; but then the output of my test run is "success", which is totally wrong.
try:
self.assertFalse(x>1, "the test failed")
except Exception as e:
print(e)
# do other post failure actions
Since the exception is caught, I assume that the unit test class won't be involved in reporting the error, and this end up with the test not failing.
How do I "escalate" the failure at the same time to both the except section and the Unit test class?