Skip to content

Commit

Permalink
test/cli/testutils.py: do not inject arguments for calls with exclusi…
Browse files Browse the repository at this point in the history
…ve options
  • Loading branch information
firewave committed Jan 2, 2025
1 parent d7ecf3b commit d30daf4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/cli/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_
exe = cppcheck_exe if cppcheck_exe else __lookup_cppcheck_exe()
assert exe is not None, 'no cppcheck binary found'

if 'TEST_CPPCHECK_INJECT_J' in os.environ:
# do not inject arguments for calls with exclusive options
has_exclusive = bool({'--doc', '--errorlist', '-h', '--help', '--version'} & set(args))

if not has_exclusive and ('TEST_CPPCHECK_INJECT_J' in os.environ):
found_j = False
for arg in args:
if arg.startswith('-j'):
Expand All @@ -162,7 +165,7 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_
arg_j = '-j' + str(os.environ['TEST_CPPCHECK_INJECT_J'])
args.append(arg_j)

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

if 'TEST_CPPCHECK_INJECT_EXECUTOR' in os.environ:
if not has_exclusive and ('TEST_CPPCHECK_INJECT_EXECUTOR' in os.environ):
found_jn = False
found_executor = False
for arg in args:
Expand Down

0 comments on commit d30daf4

Please sign in to comment.