Add Tests For LVA (#312)

* Add Tests
This commit is contained in:
aryanhasgithub authored and GitHub committed 2026-07-18 18:22:25 +02:00
1 parent 4a0695ab57
commit 9b2a8b4b30
24 files changed
+3002 -24

No files matched your search

+20 -13
View File
@@ -1,28 +1,35 @@
#!/usr/bin/env python3
import subprocess
import venv
from pathlib import Path
import sys
from pathlib import Path
_DIR = Path(__file__).parent
_PROGRAM_DIR = _DIR.parent
_VENV_DIR = _PROGRAM_DIR / ".venv"
_MODULE_DIR = _PROGRAM_DIR / "linux_voice_assistant"
_LINT_DIRS = [_MODULE_DIR]
_TEST_DIRS = _PROGRAM_DIR / "tests"
_TEST_RCFILE = _TEST_DIRS / ".pylintrc"
if _VENV_DIR.exists():
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
python_exe = context.env_exe
python_exe = str(_VENV_DIR / "bin" / "python3")
else:
python_exe = "python3"
# Überprüfen, ob --auto angegeben wurde
auto_fix = "--auto" in sys.argv
if auto_fix:
# Automatisch Korrekturen durchführen
subprocess.check_call([python_exe, "-m", "pylint"] + _LINT_DIRS + ["--fix"])
else:
# Nur prüfen, ob Code den Pylint-Standards entspricht
subprocess.check_call([python_exe, "-m", "pylint"] + _LINT_DIRS)
failed = False
try:
subprocess.check_call([python_exe, "-m", "pylint", str(_MODULE_DIR)])
except subprocess.CalledProcessError:
failed = True
try:
subprocess.check_call(
[python_exe, "-m", "pylint", str(_TEST_DIRS), "--rcfile", str(_TEST_RCFILE)]
)
except subprocess.CalledProcessError:
failed = True
if failed:
sys.exit(1)