(tmpdir, ign_proj, ign_cli=None, append_cli=False, inject_path_proj=False)
| 2085 | |
| 2086 | |
| 2087 | def __test_ignore_project(tmpdir, ign_proj, ign_cli=None, append_cli=False, inject_path_proj=False): |
| 2088 | os.mkdir(os.path.join(tmpdir, 'src')) |
| 2089 | test_file = os.path.join(tmpdir, 'src', 'test.cpp') |
| 2090 | with open(test_file, 'wt'): |
| 2091 | pass |
| 2092 | |
| 2093 | # TODO: this should say that all paths were ignored |
| 2094 | lines_exp = [ |
| 2095 | 'ignored path: {}'.format(test_file), |
| 2096 | 'cppcheck: error: could not find or open any of the paths given.', |
| 2097 | 'cppcheck: Maybe all paths were ignored?' |
| 2098 | ] |
| 2099 | |
| 2100 | if inject_path_proj: |
| 2101 | ign_proj = ign_proj.replace('$path', str(test_file)) |
| 2102 | |
| 2103 | project_file = __write_gui_project(tmpdir, test_file, ign_proj) |
| 2104 | args = [ |
| 2105 | '--debug-ignore', |
| 2106 | '--project={}'.format(project_file) |
| 2107 | ] |
| 2108 | |
| 2109 | if append_cli: |
| 2110 | args += ['-i{}'.format(ign_cli)] |
| 2111 | else: |
| 2112 | args = ['-i{}'.format(ign_cli)] + args |
| 2113 | |
| 2114 | exitcode, stdout, _ = cppcheck(args, cwd=tmpdir) |
| 2115 | assert exitcode == 1, stdout |
| 2116 | assert stdout.splitlines() == lines_exp |
| 2117 | |
| 2118 | |
| 2119 | def test_ignore_project_file(tmpdir): |
no test coverage detected