Skip to content

Commit 40aefa1

Browse files
FrancescEliesdanmar
authored andcommitted
[windows] cannot run test-misra (binary not found) (#2441)
set PYTHONPATH=addons python -m pytest addons/test/test-misra.py
1 parent 1c92170 commit 40aefa1

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

addons/test/util.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
# Helpers for pytest tests
22
import subprocess
33
import json
4+
import os
5+
6+
7+
def find_cppcheck_binary():
8+
possible_locations = [
9+
"./cppcheck",
10+
r".\bin\cppcheck.exe",
11+
]
12+
for location in possible_locations:
13+
if os.path.exists(location):
14+
break
15+
else:
16+
raise RuntimeError("Could not fine cppcheck binary")
17+
18+
return location
419

520
def dump_create(fpath, *argv):
6-
cmd = ["./cppcheck", "--dump", "--quiet", fpath] + list(argv)
21+
cppcheck_binary = find_cppcheck_binary()
22+
cmd = [cppcheck_binary, "--dump", "--quiet", fpath] + list(argv)
723
p = subprocess.Popen(cmd)
824
p.communicate()
925
if p.returncode != 0:

0 commit comments

Comments
 (0)