MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / test_config_override

Function test_config_override

test/cli/other_test.py:1936–1956  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

1934
1935
1936def test_config_override(tmpdir):
1937 # cppcheck.cfg needs to be next to executable
1938 exe = shutil.copy2(__lookup_cppcheck_exe(), tmpdir)
1939 if sys.platform == 'win32':
1940 shutil.copy2(os.path.join(os.path.dirname(__lookup_cppcheck_exe()), 'cppcheck-core.dll'), tmpdir)
1941 shutil.copytree(os.path.join(os.path.dirname(__lookup_cppcheck_exe()), 'cfg'), os.path.join(tmpdir, 'cfg'))
1942
1943 test_file = os.path.join(tmpdir, 'test.c')
1944 with open(test_file, 'wt'):
1945 pass
1946
1947 config_file = os.path.join(tmpdir, 'cppcheck.cfg')
1948 with open(config_file, 'wt') as f:
1949 f.write(json.dumps({
1950 'safety': False
1951 }))
1952
1953 exitcode, stdout, stderr, exe = cppcheck_ex(['-q', '--safety', test_file], cwd=tmpdir, cppcheck_exe=exe, remove_checkers_report=False)
1954 assert exitcode == 0, stdout if stdout else stderr
1955 assert stdout.splitlines() == []
1956 assert 'checkersReport' in stderr
1957
1958
1959def test_checkers_report(tmpdir):

Callers

nothing calls this directly

Calls 4

__lookup_cppcheck_exeFunction · 0.90
cppcheck_exFunction · 0.90
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected