[windows] cannot run test-misra (binary not found) (#2441)

set PYTHONPATH=addons
    python -m pytest addons/test/test-misra.py
This commit is contained in:
Francesc Elies 2019-12-10 18:32:41 +01:00 committed by Daniel Marjamäki
parent 1c92170179
commit 40aefa1ba4
1 changed files with 17 additions and 1 deletions

View File

@ -1,9 +1,25 @@
# Helpers for pytest tests
import subprocess
import json
import os
def find_cppcheck_binary():
possible_locations = [
"./cppcheck",
r".\bin\cppcheck.exe",
]
for location in possible_locations:
if os.path.exists(location):
break
else:
raise RuntimeError("Could not fine cppcheck binary")
return location
def dump_create(fpath, *argv):
cmd = ["./cppcheck", "--dump", "--quiet", fpath] + list(argv)
cppcheck_binary = find_cppcheck_binary()
cmd = [cppcheck_binary, "--dump", "--quiet", fpath] + list(argv)
p = subprocess.Popen(cmd)
p.communicate()
if p.returncode != 0: