(test_path)
| 196 | |
| 197 | |
| 198 | def 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 | |
| 228 | for test_path in [CONN_STRING_TEST_PATH, URI_OPTIONS_TEST_PATH]: |
no test coverage detected