I am trying to find a clean way to execute some code when the setup_class method of py.test fails. Given the following example:
class TestClass:
@classmethod
def setup_class(self):
print("I am performing setup actions!")
def test_one(self):
x = "this"
assert 'h' in x
def setup_cleanup(self):
print("I want to perfrom some cleanup action!")
How do I get the setup_cleanup method to be triggered by py.test if setup raises an exception?
Aucun commentaire:
Enregistrer un commentaire