--- a/testing/marionette/harness/marionette/marionette_test/testcases.py
+++ b/testing/marionette/harness/marionette/marionette_test/testcases.py
@@ -71,17 +71,18 @@ class JSTest:
class CommonTestCase(unittest.TestCase):
__metaclass__ = MetaParameterized
match_re = None
failureException = AssertionError
pydebugger = None
def __init__(self, methodName, **kwargs):
- unittest.TestCase.__init__(self, methodName)
+ super(CommonTestCase, self).__init__(methodName)
+
self.loglines = []
self.duration = 0
self.start_time = 0
self.expected = kwargs.pop('expected', 'pass')
self.logger = get_default_logger()
def _enter_pm(self):
if self.pydebugger:
@@ -250,18 +251,17 @@ class CommonTestCase(unittest.TestCase):
# a persistent circular reference which in turn would prevent
# proper garbage collection.
self.start_time = time.time()
self.marionette = self._marionette_weakref()
if self.marionette.session is None:
self.marionette.start_session()
self.marionette.reset_timeouts()
- def tearDown(self):
- pass
+ super(CommonTestCase, self).setUp()
def cleanTest(self):
self._deleteSession()
def _deleteSession(self):
if hasattr(self, 'start_time'):
self.duration = time.time() - self.start_time
if hasattr(self.marionette, 'session'):
@@ -426,17 +426,18 @@ class MarionetteTestCase(CommonTestCase)
def __init__(self, marionette_weakref, methodName='runTest',
filepath='', **kwargs):
self._marionette_weakref = marionette_weakref
self.marionette = None
self.methodName = methodName
self.filepath = filepath
self.testvars = kwargs.pop('testvars', None)
- CommonTestCase.__init__(self, methodName, **kwargs)
+
+ super(MarionetteTestCase, self).__init__(methodName, **kwargs)
@classmethod
def add_tests_to_suite(cls, mod_name, filepath, suite, testloader, marionette,
testvars, **kwargs):
# since we use imp.load_source to load test modules, if a module
# is loaded with the same name as another one the module would just be
# reloaded.
#
@@ -460,17 +461,17 @@ class MarionetteTestCase(CommonTestCase)
for testname in testnames:
suite.addTest(obj(weakref.ref(marionette),
methodName=testname,
filepath=filepath,
testvars=testvars,
**kwargs))
def setUp(self):
- CommonTestCase.setUp(self)
+ super(MarionetteTestCase, self).setUp()
self.marionette.test_name = self.test_name
self.marionette.execute_script("log('TEST-START: {0}:{1}')"
.format(self.filepath.replace('\\', '\\\\'),
self.methodName),
sandbox="simpletest")
def tearDown(self):
# In the case no session is active (eg. the application was quit), start
@@ -486,17 +487,17 @@ class MarionetteTestCase(CommonTestCase)
self.methodName),
sandbox="simpletest")
self.marionette.test_name = None
except (MarionetteException, IOError):
# We have tried to log the test end when there is no listener
# object that we can access
pass
- CommonTestCase.tearDown(self)
+ super(MarionetteTestCase, self).tearDown()
def wait_for_condition(self, method, timeout=30):
timeout = float(timeout) + time.time()
while time.time() < timeout:
value = method(self.marionette)
if value:
return value
time.sleep(0.5)
@@ -508,17 +509,18 @@ class MarionetteJSTestCase(CommonTestCas
match_re = re.compile(r"test_(.*)\.js$")
def __init__(self, marionette_weakref, methodName='runTest', jsFile=None, **kwargs):
assert(jsFile)
self.jsFile = jsFile
self._marionette_weakref = marionette_weakref
self.marionette = None
- CommonTestCase.__init__(self, methodName)
+
+ super(MarionetteJSTestCase, self).__init__(methodName)
@classmethod
def add_tests_to_suite(cls, mod_name, filepath, suite, testloader, marionette,
testvars, **kwargs):
suite.addTest(cls(weakref.ref(marionette), jsFile=filepath, **kwargs))
def runTest(self):
if self.marionette.session is None: