Add test check before running the main Python script.

This commit is contained in:
2024-08-20 17:58:40 -05:00
parent 40b93d9586
commit a2255eb14f
+16
View File
@@ -9,6 +9,11 @@ function Run-PythonScript {
return $process.ExitCode
}
function Run-Tests {
$process = Start-Process -FilePath "powershell" -ArgumentList "-File run_tests.ps1" -PassThru -Wait -NoNewWindow
return $process.ExitCode
}
function Git-Pull {
git pull
return $LASTEXITCODE -eq 0
@@ -17,6 +22,17 @@ function Git-Pull {
$waitTime = 15
while ($true) {
python -m pip install -r requirements.txt
Write-Host "Running tests..."
$testExitCode = Run-Tests
if ($testExitCode -ne 0) {
Write-Host "Tests failed. Waiting $waitTime seconds before next attempt..."
Start-Sleep -Seconds $waitTime
$waitTime *= 2
continue
}
Write-Host "Tests passed. Starting main Python script..."
$exitCode = Run-PythonScript -ScriptPath $PythonFile
if (Test-Path -Path ".\.doreboot") {