0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-24966 call testcase.configure only once

This commit is contained in:
Robert Guo 2016-07-19 15:19:23 -04:00
parent 4d00c7cd18
commit b9b133f4d7
2 changed files with 11 additions and 2 deletions

View File

@ -139,10 +139,13 @@ class JsCustomBehavior(CustomBehavior):
js_filename,
shell_options=shell_options,
test_kind="Hook")
self.test_case_is_configured = False
def before_suite(self, test_report):
# Configure the test case after the fixture has been set up.
self.hook_test_case.configure(self.fixture)
if not self.test_case_is_configured:
# Configure the test case after the fixture has been set up.
self.hook_test_case.configure(self.fixture)
self.test_case_is_configured = True
def after_test(self, test, test_report):
description = "{0} after running '{1}'".format(self.description, test.short_name())

View File

@ -54,6 +54,8 @@ class TestCase(unittest.TestCase):
self.fixture = None
self.return_code = None
self.is_configured = False
def long_name(self):
"""
Returns the path to the test, relative to the current working directory.
@ -82,6 +84,10 @@ class TestCase(unittest.TestCase):
"""
Stores 'fixture' as an attribute for later use during execution.
"""
if self.is_configured:
raise RuntimeError("configure can only be called once")
self.is_configured = True
self.fixture = fixture
def run_test(self):