def run(self, result=None):
        if result is None:
            result = self.defaultTestResult()
        result.startTest(self)
        test_method = getattr(self, self._testMethodName)
        self._test_method = test_method
        try:
            ok = False
            self._set_up()

            try:
                self.setUp()
            except KeyboardInterrupt:
                raise
            except:
                result.addError(self, sys.exc_info())
                #  setUp can fail because of app in some state returns internal
                #+ server error. It's good to know about it - it can say more
                #+ than that some element couldn't be found.
                try:
                    self.driver.check_expected_errors(test_method)
                    self.driver.check_expected_infos(test_method)
                except:
                    result.addError(self, sys.exc_info())
                return

            try:
                test_method()
                ok = True
            except self.failureException:
                self.make_screenshot()
                result.addFailure(self, sys.exc_info())
            except __HOLE__:
                raise
            except:
                self.make_screenshot()
                result.addError(self, sys.exc_info())

            try:
                self.driver.check_expected_errors(test_method)
                self.driver.check_expected_infos(test_method)
            except:
                ok = False
                result.addError(self, sys.exc_info())

            try:
                self.tearDown()
            except KeyboardInterrupt:
                raise
            except:
                result.addError(self, sys.exc_info())
                ok = False

            if ok:
                result.addSuccess(self)
        finally:
            if not ok:
                self.make_screenshot()

            result.stopTest(self)
            # Is nice to see at break point if test passed or not.
            # So this call have to be after stopTest which print result of test.
            self._tear_down()
dataset/ETHPy150Open horejsek/python-webdriverwrapper/webdriverwrapper/unittest/testcase.py/WebdriverTestCase.run