Skip to content

Commit

Permalink
ENH: Rewrite Windows tests (#469)
Browse files Browse the repository at this point in the history
Use Powershell instead of cmd script, exit with error code on test failures.
  • Loading branch information
cookpa committed Jun 8, 2023
1 parent 1da8ecf commit b67c22f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- master
release:
types: [created]
workflow_dispatch:

jobs:
build_wheels:
Expand Down Expand Up @@ -182,7 +183,7 @@ jobs:
if: startsWith(matrix.os, 'windows-')
run: |
python -m pip install --find-links=.\wheelhouse\cp${{ matrix.cibw_python }}-${{matrix.platform_id }} antspyx
tests\run_tests.bat
tests\run_tests.ps1
- uses: actions/upload-artifact@v3
with:
Expand Down
19 changes: 0 additions & 19 deletions tests/run_tests.bat

This file was deleted.

32 changes: 32 additions & 0 deletions tests/run_tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$PYCMD = "python"

$PYTHON_SCRIPTS = @(
"test_core_ants_image.py",
"test_core_ants_image_io.py",
"test_core_ants_transform.py",
"test_core_ants_transform_io.py",
"test_core_ants_metric.py",
"test_learn.py",
"test_registation.py",
"test_segmentation.py",
"test_utils.py",
"test_bugs.py"
)

$scriptFailed = $false

Set-Location -Path ".\tests"

foreach ($script in $PYTHON_SCRIPTS) {
Write-Host "Running Python script $script"
& $PYCMD $script $args

if ($LASTEXITCODE -ne 0) {
Write-Host "Python script $script failed with exit code $LASTEXITCODE"
$scriptFailed = $true
}
}

if ($scriptFailed) {
exit 1
}

0 comments on commit b67c22f

Please sign in to comment.