Write-Output "[PWSH] Deleting compiled extension modules..."
Remove-Item ".\src\dopt_sensor_anomalies\*.pyd" -Force
Write-Output "[PWSH] Running tests..."
pdm run pytest --cov --cov-report=html --no-cov-on-fail

if ($? -eq $false){
    Write-Output "[PWSH] Exiting script because there were failed tests"
    Write-Output "[PWSH] No coverage report was generated"
    Exit
}

Write-Output "[PWSH] Opening coverage report..."
Invoke-Item .\reports\coverage\index.html
Write-Output "[PWSH] Installing extension module..."
pdm install
Write-Output "[PWSH] Running test suite against extension module..."
pdm run pytest .\tests\test_detection.py
