(tmpdir, ign, append=False, inject_path=False)
| 1981 | |
| 1982 | |
| 1983 | def __test_ignore_file(tmpdir, ign, append=False, inject_path=False): |
| 1984 | os.mkdir(os.path.join(tmpdir, 'src')) |
| 1985 | test_file = os.path.join(tmpdir, 'src', 'test.cpp') |
| 1986 | with open(test_file, 'wt'): |
| 1987 | pass |
| 1988 | |
| 1989 | # TODO: this should say that all paths are ignored |
| 1990 | lines_exp = [ |
| 1991 | 'ignored path: {}'.format(test_file), |
| 1992 | 'cppcheck: error: could not find or open any of the paths given.', |
| 1993 | 'cppcheck: Maybe all paths were ignored?' |
| 1994 | ] |
| 1995 | |
| 1996 | args = [ |
| 1997 | '--debug-ignore', |
| 1998 | test_file |
| 1999 | ] |
| 2000 | |
| 2001 | if inject_path: |
| 2002 | ign = ign.replace('$path', str(test_file)) |
| 2003 | |
| 2004 | if append: |
| 2005 | args += ['-i{}'.format(ign)] |
| 2006 | else: |
| 2007 | args = ['-i{}'.format(ign)] + args |
| 2008 | |
| 2009 | exitcode, stdout, stderr = cppcheck(args, cwd=tmpdir) |
| 2010 | assert exitcode == 1, stdout if stdout else stderr |
| 2011 | assert stdout.splitlines() == lines_exp |
| 2012 | |
| 2013 | |
| 2014 | def test_ignore_file(tmpdir): |
no test coverage detected