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:
parent
4d00c7cd18
commit
b9b133f4d7
@ -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())
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user