def tearDown(self):
        # I see this as the only way to apply a screenshot in case we have a failure before moving on to
        # the next test. 
        if len(self._resultForDoCleanups.failures) > AppTestCase.failuresCount:
            self.takeScreenShot()
            #wait a bit so that the system managed to take a screenshot
            time.sleep(2)
            AppTestCase.failuresCount += 1
            self.isFailed = True
        if not self.settings.getboolean("OS", "debug"):
            AppLauncher.closeEmulator(self.settings)
dataset/ETHPy150Open azoft-dev-team/imagrium/src/core/testcase.py/AppTestCase.tearDown/original