(tmpdir)
| 1934 | |
| 1935 | |
| 1936 | def 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 | |
| 1959 | def test_checkers_report(tmpdir): |
nothing calls this directly
no test coverage detected