Skip to content

Commit d30daf4

Browse files
committed
test/cli/testutils.py: do not inject arguments for calls with exclusive options
1 parent d7ecf3b commit d30daf4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

test/cli/testutils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_
152152
exe = cppcheck_exe if cppcheck_exe else __lookup_cppcheck_exe()
153153
assert exe is not None, 'no cppcheck binary found'
154154

155-
if 'TEST_CPPCHECK_INJECT_J' in os.environ:
155+
# do not inject arguments for calls with exclusive options
156+
has_exclusive = bool({'--doc', '--errorlist', '-h', '--help', '--version'} & set(args))
157+
158+
if not has_exclusive and ('TEST_CPPCHECK_INJECT_J' in os.environ):
156159
found_j = False
157160
for arg in args:
158161
if arg.startswith('-j'):
@@ -162,7 +165,7 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_
162165
arg_j = '-j' + str(os.environ['TEST_CPPCHECK_INJECT_J'])
163166
args.append(arg_j)
164167

165-
if 'TEST_CPPCHECK_INJECT_CLANG' in os.environ:
168+
if not has_exclusive and ('TEST_CPPCHECK_INJECT_CLANG' in os.environ):
166169
found_clang = False
167170
for arg in args:
168171
if arg.startswith('--clang'):
@@ -172,7 +175,7 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_
172175
arg_clang = '--clang=' + str(os.environ['TEST_CPPCHECK_INJECT_CLANG'])
173176
args.append(arg_clang)
174177

175-
if 'TEST_CPPCHECK_INJECT_EXECUTOR' in os.environ:
178+
if not has_exclusive and ('TEST_CPPCHECK_INJECT_EXECUTOR' in os.environ):
176179
found_jn = False
177180
found_executor = False
178181
for arg in args:

0 commit comments

Comments
 (0)