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

Function test_config_invalid

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

Source from the content-addressed store, hash-verified

1912
1913
1914def test_config_invalid(tmpdir):
1915 # cppcheck.cfg needs to be next to executable
1916 exe = shutil.copy2(__lookup_cppcheck_exe(), tmpdir)
1917 if sys.platform == 'win32':
1918 shutil.copy2(os.path.join(os.path.dirname(__lookup_cppcheck_exe()), 'cppcheck-core.dll'), tmpdir)
1919 shutil.copytree(os.path.join(os.path.dirname(__lookup_cppcheck_exe()), 'cfg'), os.path.join(tmpdir, 'cfg'))
1920
1921 test_file = os.path.join(tmpdir, 'test.c')
1922 with open(test_file, 'wt'):
1923 pass
1924
1925 config_file = os.path.join(tmpdir, 'cppcheck.cfg')
1926 with open(config_file, 'wt'):
1927 pass
1928
1929 exitcode, stdout, stderr, exe = cppcheck_ex([test_file], cwd=tmpdir, cppcheck_exe=exe)
1930 assert exitcode == 1, stdout if stdout else stderr
1931 assert stdout.splitlines() == [
1932 'cppcheck: error: could not load cppcheck.cfg - not a valid JSON - syntax error at line 1 near: '
1933 ]
1934
1935
1936def test_config_override(tmpdir):

Callers

nothing calls this directly

Calls 3

__lookup_cppcheck_exeFunction · 0.90
cppcheck_exFunction · 0.90
joinMethod · 0.45

Tested by

no test coverage detected