Skip to content

Commit

Permalink
Merge pull request #9084 from gem/windows-separate-pytest
Browse files Browse the repository at this point in the history
Separate tests for calculators and advanced manual, to avoid false negatives in case of broken calculators
  • Loading branch information
ptormene committed Oct 9, 2023
2 parents 354f1fc + 20fbaa0 commit 8475695
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/engine_pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
python install.py devel --version=$GITHUB_HEAD_REF --repository=$GITHUB_REPOSITORY
- name: Calculators and documentation tests
run: |
set -e
source ~/openquake/bin/activate
pip install pytest https://wheelhouse.openquake.org/v3/py/rtgmpy-1.0.0-py3-none-any.whl
oq dbserver start
Expand All @@ -52,6 +53,7 @@ jobs:
python install.py devel --version=$GITHUB_HEAD_REF --repository=$GITHUB_REPOSITORY
- name: Hazardlib tests
run: |
set -e
source ~/openquake/bin/activate
pip install pyshp pytest flake8 https://wheelhouse.openquake.org/v3/py/rtgmpy-1.0.0-py3-none-any.whl
oq dbserver start
Expand Down
56 changes: 31 additions & 25 deletions .github/workflows/windows_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,40 +78,21 @@ jobs:
C:\Users\runneradmin\openquake\Scripts\activate.ps1
python -m pip install pytest pyshp flake8
- name: Run all demos
- name: Run tests for calculators
if: always()
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
# FIXME: why those different exports? (using the same as in run-demos.sh)
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' dbserver start}
Write-Host "Run all demos having only job.ini"
$iniFilePaths = Get-ChildItem D:\a\oq-engine\oq-engine\demos -Recurse -Filter job.ini
foreach($iniFilePath in $iniFilePaths) {
Write-Host "Run $($iniFilePath.FullName)"
oq engine --run $iniFilePath.FullName --exports csv,hdf5
}
Write-Host "Run all demos having only job_hazard.ini and job_risk.ini"
$demoDirs = Get-ChildItem D:\a\oq-engine\oq-engine\demos -Recurse -Directory
foreach($demoDir in $demoDirs) {
$jobHazardPaths = Get-ChildItem $demoDir -Filter job_hazard.ini
foreach($jobHazardPath in $jobHazardPaths) {
Write-Host "Run $($jobHazardPath.FullName)"
oq engine --run $jobHazardPath.FullName --exports csv,hdf5
$jobRiskPath = $demoDir.FullName + "\job_risk.ini"
Write-Host "Run $($jobRiskPath)"
oq engine --run $jobRiskPath --exports csv,hdf5 --hc -1
}
}
- name: Run tests for calculators and advanced manual
cd D:\a\oq-engine\oq-engine
pytest --doctest-modules --disable-warnings --color=yes --durations=10 openquake/calculators
- name: Run tests for advanced manual
if: always()
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' dbserver start}
cd D:\a\oq-engine\oq-engine
pytest --doctest-modules --disable-warnings --color=yes --durations=10 openquake/calculators
cd doc/adv-manual
cd D:\a\oq-engine\oq-engine\doc\adv-manual
pytest @(get-childitem -name *.rst)
- name: Run tests for hazardlib, sep, commands, engine, hmtk, risklib, commonlib and baselib to test installation
Expand Down Expand Up @@ -160,3 +141,28 @@ jobs:
$Env:OQ_CONFIG_FILE='openquake\server\tests\data\openquake.cfg'
# -v 2 also logs the test names
python .\openquake\server\manage.py test -v 2 tests.test_aelo_mode
- name: Run all demos
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' dbserver start}
Write-Host "Run all demos having only job.ini"
$iniFilePaths = Get-ChildItem D:\a\oq-engine\oq-engine\demos -Recurse -Filter job.ini
foreach($iniFilePath in $iniFilePaths) {
Write-Host "Run $($iniFilePath.FullName)"
oq engine --run $iniFilePath.FullName --exports csv,hdf5
}
Write-Host "Run all demos having only job_hazard.ini and job_risk.ini"
$demoDirs = Get-ChildItem D:\a\oq-engine\oq-engine\demos -Recurse -Directory
foreach($demoDir in $demoDirs) {
$jobHazardPaths = Get-ChildItem $demoDir -Filter job_hazard.ini
foreach($jobHazardPath in $jobHazardPaths) {
Write-Host "Run $($jobHazardPath.FullName)"
oq engine --run $jobHazardPath.FullName --exports csv,hdf5
$jobRiskPath = $demoDir.FullName + "\job_risk.ini"
Write-Host "Run $($jobRiskPath)"
oq engine --run $jobRiskPath --exports csv,hdf5 --hc -1
}
}

0 comments on commit 8475695

Please sign in to comment.