diff --git a/test/maple_test/compare.py b/test/maple_test/compare.py index b63206acb700dcc7266fd29193ccee73b69c6da9..a2f9c2ef987f8f5406b4eb1163e817c7f07efb7a 100644 --- a/test/maple_test/compare.py +++ b/test/maple_test/compare.py @@ -171,7 +171,7 @@ def is_valid_pattern(pattern): def regex_match(content, line_map, pattern, start=0): - pattern = r"\s*".join([word for word in pattern.split()]) + pattern = r"\s+".join([word for word in pattern.split()]) matches = re.finditer(str(pattern), content, re.MULTILINE) end = 0 for _, match in enumerate(matches, start=1): @@ -279,7 +279,7 @@ def extract_compare_lines(file_path, regex): def parse_cli(): - parser = argparse.ArgumentParser(prog="compare") + parser = argparse.ArgumentParser(prog="compare.py") parser.add_argument("--comment", help="Test case comment") parser.add_argument( "--assert_flag", diff --git a/test/maple_test/task.py b/test/maple_test/task.py index da482f23e7912ddcc8f58c0bd1e9e34e777b4346..e6d4131499d8408f0f6bcd0a1379fc000edbfdb0 100644 --- a/test/maple_test/task.py +++ b/test/maple_test/task.py @@ -32,6 +32,7 @@ from maple_test.utils import ( FAIL, NOT_RUN, UNRESOLVED, + OS_SEP, ) from maple_test.utils import ( read_config, @@ -52,7 +53,7 @@ class TaskConfig: self.suffix_comments = {} else: self.inherit_top_config(top_config) - name = str(path.relative_to(top_config.path.parent)).replace("/", "_") + name = str(path.relative_to(top_config.path.parent)).replace(OS_SEP, "_") self.name = name.replace(".", "_") self.path = complete_path(path) self.base_dir = self.path.parent @@ -169,7 +170,7 @@ class TestSuiteTask: base_dir = config.base_dir testlist = self._get_testlist(raw_config, base_dir, encoding) self.task_set_result[name] = OrderedDict( - {"PASS": 0, "FAIL": 0, "NOT_RUN": 0, "UNRESOLVED": 0} + {PASS: 0, FAIL: 0, NOT_RUN: 0, UNRESOLVED: 0} ) for case in self._search_list(base_dir, testlist, encoding): task = SingleTask(case, config, running_config) @@ -282,7 +283,7 @@ class TestSuiteTask: print_type = configs.get_val("print_type") for line in self.gen_summary(print_type).splitlines(): logger.info(line) - return self.result["FAIL"] + return self.result[FAIL] def gen_brief_summary(self): total = sum(self.result.values()) diff --git a/test/maple_test/utils.py b/test/maple_test/utils.py index bf2d54a8405bd015d2b3d9d3b7df392bf0c2e633..14b3a709335434e4ad1e54921ebc6afb60563ff2 100644 --- a/test/maple_test/utils.py +++ b/test/maple_test/utils.py @@ -47,6 +47,7 @@ RESULT = { BASE_DIR = Path(__file__).parent.absolute() ENCODING = locale.getdefaultlocale()[1] if locale.getdefaultlocale()[1] else "UTF-8" +OS_SEP = os.path.sep EXECUTABLE = sys.executable COMPARE = BASE_DIR / "compare.py"