46 lines
1.2 KiB
Batchfile
46 lines
1.2 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
setlocal
|
|
set "PYTHONUTF8=1"
|
|
cd /d "%~dp0"
|
|
title Taetigkeitsnachweis-Generator - Tests
|
|
|
|
echo ========================================
|
|
echo Alle Tests ausfuehren
|
|
echo ========================================
|
|
echo.
|
|
|
|
if not exist ".venv\Scripts\python.exe" (
|
|
echo [FEHLER] Die virtuelle Umgebung fehlt. Bitte zuerst start.bat ausfuehren.
|
|
set "TEST_EXIT_CODE=1"
|
|
goto finish
|
|
)
|
|
|
|
".venv\Scripts\python.exe" -c "import pytest" >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [INFO] Installiere pytest in der Projektumgebung...
|
|
".venv\Scripts\python.exe" -m pip install pytest
|
|
if errorlevel 1 (
|
|
echo [FEHLER] pytest konnte nicht installiert werden.
|
|
set "TEST_EXIT_CODE=1"
|
|
goto finish
|
|
)
|
|
)
|
|
|
|
REM Keine Abbruchoption: Auch nach fehlgeschlagenen Tests laeuft die Suite weiter.
|
|
REM Ohne Cache funktioniert der Testlauf auch bei gesperrtem pytest-Cache.
|
|
".venv\Scripts\python.exe" -m pytest tests -v -p no:cacheprovider
|
|
set "TEST_EXIT_CODE=%ERRORLEVEL%"
|
|
|
|
echo.
|
|
if "%TEST_EXIT_CODE%"=="0" (
|
|
echo [OK] Alle Tests bestanden.
|
|
) else (
|
|
echo [FEHLER] Testlauf nicht erfolgreich. Details stehen oben.
|
|
)
|
|
|
|
:finish
|
|
REM Fuer automatisierte Aufrufe: test.bat --no-pause
|
|
if /I not "%~1"=="--no-pause" pause
|
|
exit /b %TEST_EXIT_CODE%
|