Skip to content

Commit

Permalink
refs #12274 - test/cli/suppress-syntaxError_test.py: made it location…
Browse files Browse the repository at this point in the history
…-independent (#6638)
  • Loading branch information
firewave authored Jul 25, 2024
1 parent 4a38b00 commit dc3ec3f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/cli/suppress-syntaxError_test.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@

# python -m pytest test-suppress-syntaxError.py

import os
from testutils import cppcheck

__script_dir = os.path.dirname(os.path.abspath(__file__))

def test_j():
ret, stdout, stderr = cppcheck(['-q', '--error-exitcode=1', '-j2', '-q', 'proj-suppress-syntaxError'])
ret, stdout, stderr = cppcheck(['-q', '--error-exitcode=1', '-j2', '-q', 'proj-suppress-syntaxError'], cwd=__script_dir)
assert ret == 1, stdout
assert len(stderr) > 0

def test_suppress_j():
ret, stdout, stderr = cppcheck(['-q', '--error-exitcode=1', '--suppress=*:proj-suppress-syntaxError/*', '-j2', '-q', 'proj-suppress-syntaxError'])
ret, stdout, stderr = cppcheck(['-q', '--error-exitcode=1', '--suppress=*:proj-suppress-syntaxError/*', '-j2', '-q', 'proj-suppress-syntaxError'], cwd=__script_dir)
assert ret == 0, stdout
assert len(stderr) == 0

# TODO: test with -j2
def test_safety_suppress_syntax_error_implicitly(tmpdir):
ret, stdout, stderr = cppcheck(['-q', '--safety', '--suppress=*', 'proj-suppress-syntaxError', '-j1'], remove_checkers_report=False)
ret, stdout, stderr = cppcheck(['-q', '--safety', '--suppress=*', 'proj-suppress-syntaxError', '-j1'], remove_checkers_report=False, cwd=__script_dir)
assert ret == 1, stdout
assert '[syntaxError]' in stderr
assert 'Active checkers: There was critical errors' in stderr

# TODO: test with -j2
def test_safety_suppress_syntax_error_explicitly():
ret, stdout, stderr = cppcheck(['-q', '--safety', '--suppress=syntaxError', 'proj-suppress-syntaxError', '-j1'], remove_checkers_report=False)
ret, stdout, stderr = cppcheck(['-q', '--safety', '--suppress=syntaxError', 'proj-suppress-syntaxError', '-j1'], remove_checkers_report=False, cwd=__script_dir)
assert ret == 1, stdout
assert '[syntaxError]' not in stderr
assert 'Active checkers: There was critical errors' in stderr

0 comments on commit dc3ec3f

Please sign in to comment.