pierrepo / PBxplore

A suite of tools to explore protein structures with Protein Blocks :snake:
https://pbxplore.readthedocs.org/en/latest/
MIT License
28 stars 17 forks source link

Fix the cleaning of outputs in test_regression #44

Closed jbarnoud closed 9 years ago

jbarnoud commented 9 years ago

In previous versions, the output of the regression tests where cleaned only of the test pass. The cleaning was placed after the assertions, so it was executed only if the assertion passed. This caused an issue with the tests that were supposed to fail the assertion (i.e the tests decorated with _failure_test).

Here I placed the cleaning in a tearDown function that is executed after each tests whether it passes or not.

On python 2, I test if the test passed using the sys.exc_info() function as described in http://stackoverflow.com/questions/4414234/getting-pythons-unittest-results-in-a-teardown-method so I can clean the outputs only if the test passes.

This method does not work on python 3. So, on python 3, I clean the outputs regardless of the test outcome.

Fix #43