def gen_tests(filter_rgx): if filter_rgx: is_to_run = re.compile(filter_rgx).search else: is_to_run = lambda x: 1 tests = [] for module_file, messages_file in _get_tests_info(INPUT_DIR, MSG_DIR, "func_", ""): if not is_to_run(module_file) or module_file.endswith((".pyc", "$py.class")): continue base = module_file.replace(".py", "").split("_")[1] dependencies = _get_tests_info(INPUT_DIR, MSG_DIR, base, ".py") tests.append((module_file, messages_file, dependencies)) if UPDATE: return tests assert len(tests) < 196, "Please do not add new test cases here." return tests
def gen_tests(filter_rgx): if filter_rgx: is_to_run = re.compile(filter_rgx).search else: is_to_run = lambda x: 1 # noqa: E731 We're going to throw all this anyway tests = [] for module_file, messages_file in _get_tests_info(INPUT_DIR, MSG_DIR, "func_", ""): if not is_to_run(module_file) or module_file.endswith((".pyc", "$py.class")): continue base = module_file.replace(".py", "").split("_")[1] dependencies = _get_tests_info(INPUT_DIR, MSG_DIR, base, ".py") tests.append((module_file, messages_file, dependencies)) if UPDATE_FILE.exists(): return tests assert len(tests) < 12, "Please do not add new test cases here." + "\n".join( str(k) for k in tests if not k[2] ) return tests