зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a3b107922e81 (bug 1595814) for causing marionette perma failures CLOSED TREE
This commit is contained in:
Родитель
764bd4d432
Коммит
d73714a862
|
@ -14,7 +14,11 @@ import unittest
|
|||
import warnings
|
||||
import weakref
|
||||
|
||||
from unittest.case import SkipTest
|
||||
from unittest.case import (
|
||||
_ExpectedFailure,
|
||||
_UnexpectedSuccess,
|
||||
SkipTest,
|
||||
)
|
||||
|
||||
from marionette_driver.errors import (
|
||||
TimeoutException,
|
||||
|
@ -32,24 +36,6 @@ def _wraps_parameterized(func, func_suffix, args, kwargs):
|
|||
return wrapper
|
||||
|
||||
|
||||
class ExpectedFailure(Exception):
|
||||
"""
|
||||
Raise this when a test is expected to fail.
|
||||
|
||||
This is an implementation detail.
|
||||
"""
|
||||
|
||||
def __init__(self, exc_info):
|
||||
super(ExpectedFailure, self).__init__()
|
||||
self.exc_info = exc_info
|
||||
|
||||
|
||||
class UnexpectedSuccess(Exception):
|
||||
"""
|
||||
The test was supposed to fail, but it didn't!
|
||||
"""
|
||||
|
||||
|
||||
class MetaParameterized(type):
|
||||
"""
|
||||
A metaclass that allow a class to use decorators.
|
||||
|
@ -149,14 +135,14 @@ class CommonTestCase(unittest.TestCase):
|
|||
try:
|
||||
self.setUp()
|
||||
except Exception:
|
||||
raise ExpectedFailure(sys.exc_info())
|
||||
raise _ExpectedFailure(sys.exc_info())
|
||||
else:
|
||||
self.setUp()
|
||||
except SkipTest as e:
|
||||
self._addSkip(result, str(e))
|
||||
except (KeyboardInterrupt, UnresponsiveInstanceException):
|
||||
raise
|
||||
except ExpectedFailure as e:
|
||||
except _ExpectedFailure as e:
|
||||
expected_failure(result, e.exc_info)
|
||||
except Exception:
|
||||
self._enter_pm()
|
||||
|
@ -167,8 +153,8 @@ class CommonTestCase(unittest.TestCase):
|
|||
try:
|
||||
testMethod()
|
||||
except Exception:
|
||||
raise ExpectedFailure(sys.exc_info())
|
||||
raise UnexpectedSuccess
|
||||
raise _ExpectedFailure(sys.exc_info())
|
||||
raise _UnexpectedSuccess
|
||||
else:
|
||||
testMethod()
|
||||
except self.failureException:
|
||||
|
@ -176,9 +162,9 @@ class CommonTestCase(unittest.TestCase):
|
|||
result.addFailure(self, sys.exc_info())
|
||||
except (KeyboardInterrupt, UnresponsiveInstanceException):
|
||||
raise
|
||||
except ExpectedFailure as e:
|
||||
except _ExpectedFailure as e:
|
||||
expected_failure(result, e.exc_info)
|
||||
except UnexpectedSuccess:
|
||||
except _UnexpectedSuccess:
|
||||
addUnexpectedSuccess = getattr(result, 'addUnexpectedSuccess', None)
|
||||
if addUnexpectedSuccess is not None:
|
||||
addUnexpectedSuccess(self)
|
||||
|
@ -199,12 +185,12 @@ class CommonTestCase(unittest.TestCase):
|
|||
try:
|
||||
self.tearDown()
|
||||
except Exception:
|
||||
raise ExpectedFailure(sys.exc_info())
|
||||
raise _ExpectedFailure(sys.exc_info())
|
||||
else:
|
||||
self.tearDown()
|
||||
except (KeyboardInterrupt, UnresponsiveInstanceException):
|
||||
raise
|
||||
except ExpectedFailure as e:
|
||||
except _ExpectedFailure as e:
|
||||
expected_failure(result, e.exc_info)
|
||||
except Exception:
|
||||
self._enter_pm()
|
||||
|
|
Загрузка…
Ссылка в новой задаче