[FIX] tests: make sure that a failed tests does not leave the environment dirty

When a failure occurs, or when exiting an assertRaises(), the environment
should not contain fields to recompute.