Override fixture context methods with setup/cleanup functions

Change-Id: I68028cd86a6d065be3e2be4530d0632d46789e9d
This commit is contained in:
Federico Ressi
2020-01-28 10:43:59 +01:00
parent 1f0611f058
commit 15f7a3df48
+7
View File
@@ -379,6 +379,13 @@ class SharedFixture(fixtures.Fixture):
self._cleanup_executed = True
return result
def __enter__(self):
return setup_fixture(self)
def __exit__(self, exc_type, exc_val, exc_tb): # noqa
cleanup_fixture(self)
return False # propagate exceptions from the with body.
def _setUp(self):
self.setup_fixture()