I have written test cases, during the test case execution changes will be create, that changes will clean up by merging/abandoning at end. But sometimes some exceptions will raised between the merging/abandoning on clean up process.
Can we think about a way to delete the changes created during the test instead only merging/abandoning them?
class TestChangeMerge(object):
@pytest.fixture(autouse=True)
def setup(self, conf, git, gerrit):
self.git = git(config)
self.gerrit = gerrit(config)
def test_change_merge(self):
log.info("STEP 1 : git-clone")
self.git.clone()
log.info("STEP 2 : Create commit and push new change")
self.git.push_change()
log.info("STEP 3 : Checking results")
assert (self.gerrit.change_status(self.git.change_id))
def teardown(self):
self.git.cleanup()
self.gerrit.cleanup()
#Here we have stated cleanup, used ssh command 'gerrit review --abandon', in case failed on abandon then what is alternate way to cleanup.