Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 4998fd1

Browse files
committed
Fix --skip-file option
When --skip-file is used with --skip-tests, merge of the two is not well done and we have some missing tests in the skip rule. With this patch we introduce a new variable storing both of skip options in a regex format. Signed-off-by: Andrea Cervesato <[email protected]>
1 parent fa94710 commit 4998fd1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ltp/main.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ def _get_skip_tests(skip_tests: str, skip_file: str) -> str:
152152
"""
153153
Return the skipped tests regexp.
154154
"""
155+
skip = ""
156+
155157
if skip_file:
156158
lines = None
157159
with open(skip_file, 'r', encoding="utf-8") as skip_file_data:
@@ -162,9 +164,15 @@ def _get_skip_tests(skip_tests: str, skip_file: str) -> str:
162164
for line in lines
163165
if not re.search(r'^\s+#.*', line)
164166
]
165-
skip_tests = '|'.join(toskip) + '|' + skip_tests
167+
skip = '|'.join(toskip)
168+
169+
if skip_tests:
170+
if skip_file:
171+
skip += "|"
172+
173+
skip += skip_tests
166174

167-
return skip_tests
175+
return skip
168176

169177

170178
def _start_session(parser: ArgumentParser, args: Namespace) -> None:

0 commit comments

Comments
 (0)