(tmpdir)
| 1912 | |
| 1913 | |
| 1914 | def 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 | |
| 1936 | def test_config_override(tmpdir): |
nothing calls this directly
no test coverage detected