@@ -23,13 +23,6 @@ def create_compile_commands():
2323 with open ('proj2/' + COMPILE_COMMANDS_JSON , 'wt' ) as f :
2424 f .write (json .dumps (j ))
2525
26- # Run Cppcheck from project path
27- def cppcheck_local (args ):
28- cwd = os .getcwd ()
29- os .chdir ('proj2' )
30- ret , stdout , stderr = cppcheck (args )
31- os .chdir (cwd )
32- return ret , stdout , stderr
3326
3427def test_file_filter ():
3528 ret , stdout , _ = cppcheck (['proj2/' ,'--file-filter=proj2/a/*' ])
@@ -43,7 +36,7 @@ def test_file_filter():
4336
4437def test_local_path ():
4538 create_compile_commands ()
46- ret , stdout , _ = cppcheck_local (['--project=compile_commands.json' ])
39+ ret , stdout , _ = cppcheck (['--project=compile_commands.json' ], cwd = 'proj2' )
4740 file1 = os .path .join ('a' , 'a.c' )
4841 file2 = os .path .join ('b' , 'b.c' )
4942 assert ret == 0 , stdout
@@ -52,13 +45,13 @@ def test_local_path():
5245
5346def test_local_path_force ():
5447 create_compile_commands ()
55- ret , stdout , _ = cppcheck_local (['--project=compile_commands.json' , '--force' ])
48+ ret , stdout , _ = cppcheck (['--project=compile_commands.json' , '--force' ], cwd = 'proj2' )
5649 assert ret == 0 , stdout
5750 assert stdout .find ('AAA' ) >= 0
5851
5952def test_local_path_maxconfigs ():
6053 create_compile_commands ()
61- ret , stdout , _ = cppcheck_local (['--project=compile_commands.json' , '--max-configs=2' ])
54+ ret , stdout , _ = cppcheck (['--project=compile_commands.json' , '--max-configs=2' ], cwd = 'proj2' )
6255 assert ret == 0 , stdout
6356 assert stdout .find ('AAA' ) >= 0
6457
0 commit comments