(tmpdir, extra_args, append=False, inject_path=False)
| 2175 | |
| 2176 | |
| 2177 | def __test_ignore_project_2(tmpdir, extra_args, append=False, inject_path=False): |
| 2178 | os.mkdir(os.path.join(tmpdir, 'src')) |
| 2179 | test_file = os.path.join(tmpdir, 'src', 'test.cpp') |
| 2180 | with open(test_file, 'wt'): |
| 2181 | pass |
| 2182 | |
| 2183 | lines_exp = [ |
| 2184 | 'ignored path: {}'.format(str(test_file).replace('\\', '/')), |
| 2185 | 'cppcheck: error: no C or C++ source files found.', |
| 2186 | 'cppcheck: all paths were ignored' |
| 2187 | ] |
| 2188 | project_file = __write_compdb(tmpdir, test_file) |
| 2189 | args = [ |
| 2190 | '--debug-ignore', |
| 2191 | '--project={}'.format(project_file) |
| 2192 | ] |
| 2193 | |
| 2194 | if inject_path: |
| 2195 | extra_args = [ extra_args[0].replace('$path', str(test_file)) ] |
| 2196 | if append: |
| 2197 | args += extra_args |
| 2198 | else: |
| 2199 | args = extra_args + args |
| 2200 | print(args) |
| 2201 | |
| 2202 | exitcode, stdout, stderr = cppcheck(args, cwd=tmpdir) |
| 2203 | assert exitcode == 1, stdout if stdout else stderr |
| 2204 | assert stdout.splitlines() == lines_exp |
| 2205 | |
| 2206 | |
| 2207 | def test_ignore_project_2_file(tmpdir): |
no test coverage detected