[CmdletBinding()] param([string]$PythonExecutable = 'python', [string[]]$TestPath = @('tests/part_replace', 'tests/trial_task_center', 'tests/ui', 'tests/integration', 'tests/packaging')) $ErrorActionPreference = 'Stop' $testRepository = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path $testPreviousPythonPath = $env:PYTHONPATH $testPreviousQtPlatform = $env:QT_QPA_PLATFORM try { $env:PYTHONPATH = Join-Path $testRepository 'src' $env:QT_QPA_PLATFORM = 'offscreen' Push-Location $testRepository & $PythonExecutable -m pytest -q @TestPath --durations=10 $testResult = $LASTEXITCODE } finally { Pop-Location $env:PYTHONPATH = $testPreviousPythonPath $env:QT_QPA_PLATFORM = $testPreviousQtPlatform } exit $testResult