Bug 821018 - Fix XML output when tests have been skipped, r=jgriffin
authorMihnea Dobrescu-Balaur <mihneadb@gmail.com>
Wed, 12 Dec 2012 15:29:47 -0800
changeset 115859 652e6b974c13
parent 115858 7ed78ee40e0e
child 115860 8bfd7767182c
push id24028
push useremorley@mozilla.com
push date2012-12-13 15:56 +0000
treeherdermozilla-central@9db79b97abbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs821018
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 821018 - Fix XML output when tests have been skipped, r=jgriffin
testing/marionette/client/marionette/marionette_test.py
testing/marionette/client/setup.py
--- a/testing/marionette/client/marionette/marionette_test.py
+++ b/testing/marionette/client/marionette/marionette_test.py
@@ -25,16 +25,17 @@ def skip_if_b2g(target):
 class CommonTestCase(unittest.TestCase):
 
     match_re = None
 
     def __init__(self, methodName):
         unittest.TestCase.__init__(self, methodName)
         self.loglines = None
         self.perfdata = None
+        self.duration = 0
 
     @classmethod
     def match(cls, filename):
         """
         Determines if the specified filename should be handled by this
         test class; this is done by looking for a match for the filename
         using cls.match_re.
         """
@@ -78,21 +79,23 @@ permissions.forEach(function (perm) {
         """, [url, permissions])
         emulator.set_context("content")
 
     def setUp(self):
         # Convert the marionette weakref to an object, just for the
         # duration of the test; this is deleted in tearDown() to prevent
         # 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()
 
     def tearDown(self):
+        self.duration = time.time() - self.start_time
         if self.marionette.session is not None:
             self.loglines = self.marionette.get_logs()
             self.perfdata = self.marionette.get_perf_data()
             self.marionette.delete_session()
         self.marionette = None
 
 class MarionetteTestCase(CommonTestCase):
 
@@ -120,23 +123,21 @@ class MarionetteTestCase(CommonTestCase)
                 for testname in testnames:
                     suite.addTest(obj(weakref.ref(marionette),
                                   methodName=testname,
                                   filepath=filepath,
                                   testvars=testvars))
 
     def setUp(self):
         CommonTestCase.setUp(self)
-        self.start_time = time.time()
         self.marionette.test_name = self.test_name
         self.marionette.execute_script("log('TEST-START: %s:%s')" % 
                                        (self.filepath.replace('\\', '\\\\'), self.methodName))
 
     def tearDown(self):
-        self.duration = time.time() - self.start_time
         self.marionette.set_context("content")
         self.marionette.execute_script("log('TEST-END: %s:%s')" % 
                                        (self.filepath.replace('\\', '\\\\'), self.methodName))
         self.marionette.test_name = None
         CommonTestCase.tearDown(self)
 
     def get_new_emulator(self):
         self.extra_emulator_index += 1
--- a/testing/marionette/client/setup.py
+++ b/testing/marionette/client/setup.py
@@ -1,12 +1,12 @@
 import os
 from setuptools import setup, find_packages
 
-version = '0.5.11'
+version = '0.5.12'
 
 # get documentation from the README
 try:
     here = os.path.dirname(os.path.abspath(__file__))
     description = file(os.path.join(here, 'README.md')).read()
 except (OSError, IOError):
     description = ''