Bug 888506 - Check that the start_time attribute exists before trying to use it. r=jgriffin

This commit is contained in:
Mathieu Bultel mat.bultel@gmail.com 2013-07-01 12:37:21 +02:00
parent 158694a98f
commit 4ef150e60c
2 changed files with 36 additions and 1 deletions

View File

@ -247,7 +247,8 @@ permissions.forEach(function (perm) {
self._deleteSession()
def _deleteSession(self):
self.duration = time.time() - self.start_time
if hasattr(self, 'start_time'):
self.duration = time.time() - self.start_time
if hasattr(self.marionette, 'session'):
if self.marionette.session is not None:
try:

View File

@ -0,0 +1,34 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_test import MarionetteTestCase, SkipTest
class TestSetUpSkipped(MarionetteTestCase):
testVar = {'test':'SkipTest'}
def setUp(self):
try:
self.testVar['email']
except KeyError:
raise SkipTest('email key not present in dict, skip ...')
MarionetteTestCase.setUp(self)
def test_assert(self):
assert True
class TestSetUpNotSkipped(MarionetteTestCase):
testVar = {'test':'SkipTest'}
def setUp(self):
try:
self.testVar['test']
except KeyError:
raise SkipTest('email key not present in dict, skip ...')
MarionetteTestCase.setUp(self)
def test_assert(self):
assert True