MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / create_tests

Function create_tests

test/test_uri_spec.py:198–225  ·  view source on GitHub ↗
(test_path)

Source from the content-addressed store, hash-verified

196
197
198def create_tests(test_path):
199 for dirpath, _, filenames in os.walk(test_path):
200 dirname = os.path.split(dirpath)
201 dirname = os.path.split(dirname[-2])[-1] + "_" + dirname[-1]
202
203 for filename in filenames:
204 if not filename.endswith(".json"):
205 # skip everything that is not a test specification
206 continue
207 json_path = os.path.join(dirpath, filename)
208 with open(json_path, encoding="utf-8") as scenario_stream:
209 scenario_def = json.load(scenario_stream)
210
211 for testcase in scenario_def["tests"]:
212 dsc = testcase["description"]
213
214 if dsc in TEST_DESC_SKIP_LIST:
215 print("Skipping test '%s'" % dsc)
216 continue
217
218 testmethod = create_test(testcase, dirpath)
219 testname = "test_{}_{}_{}".format(
220 dirname,
221 os.path.splitext(filename)[0],
222 str(dsc).replace(" ", "_"),
223 )
224 testmethod.__name__ = testname
225 setattr(TestAllScenarios, testmethod.__name__, testmethod)
226
227
228for test_path in [CONN_STRING_TEST_PATH, URI_OPTIONS_TEST_PATH]:

Callers 1

test_uri_spec.pyFile · 0.70

Calls 2

create_testFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected