Skip to content

Commit

Permalink
Add pytest-timeout to CI (MDAnalysis#4215)
Browse files Browse the repository at this point in the history
* Switch to using pytest-timeout for azure and cirrus
* Add gh actions timeout calls
* Revert test timeout leftover from previous PR
  • Loading branch information
IAlibay authored Jul 31, 2023
1 parent 938607c commit 66a2b21
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .github/actions/setup-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ inputs:
default: 'coverage'
pytest-cov:
default: 'pytest-cov'
pytest-timeout:
default: 'pytest-timeout'
pytest-xdist:
default: 'pytest-xdist'
trove-classifiers:
Expand Down Expand Up @@ -157,6 +159,7 @@ runs:
PIP_MIN_DEPS: |
${{ inputs.coverage }}
${{ inputs.pytest-cov }}
${{ inputs.pytest-timeout }}
${{ inputs.pytest-xdist }}
${{ inputs.trove-classifiers }}
PIP_OPT_DEPS: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ jobs:
- name: install_min_deps
if: "matrix.type == 'MIN'"
run: |
pip install pytest pytest-xdist
pip install pytest pytest-xdist pytest-timeout
- name: pip_install_mda
run: |
Expand All @@ -255,4 +255,4 @@ jobs:
- name: run_tests
run: |
pytest -n2 --pyargs MDAnalysisTests
pytest --timeout=200 -n auto --pyargs MDAnalysisTests
16 changes: 8 additions & 8 deletions .github/workflows/gh-ci-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

- name: run_tests
run: |
pytest -n auto testsuite/MDAnalysisTests --durations=50 -W error::FutureWarning
pytest --timeout=200 -n auto testsuite/MDAnalysisTests --durations=50 -W error::FutureWarning
# Issue #3442
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:

- name: run_tests
run: |
pytest -n auto testsuite/MDAnalysisTests --disable-pytest-warnings --durations=50
pytest --timeout=200 -n auto testsuite/MDAnalysisTests --disable-pytest-warnings --durations=50
old_ubuntu_macos:
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:

- name: run_tests
run: |
pytest -n auto testsuite/MDAnalysisTests --disable-pytest-warnings --durations=50
pytest --timeout=200 -n auto testsuite/MDAnalysisTests --disable-pytest-warnings --durations=50
# Issue 1727
Expand Down Expand Up @@ -201,11 +201,11 @@ jobs:
- name: install_pip_extras
run: |
pip install pytest-xdist
pip install pytest-xdist pytest-timeout
- name: run_tests
run: |
pytest -n auto testsuite/MDAnalysisTests --disable-pytest-warnings --durations=50
pytest --timeout=200 -n auto testsuite/MDAnalysisTests --disable-pytest-warnings --durations=50
# Issue 4208
conda-latest-release:
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
- name: run_tests
run: |
pytest -n auto --pyargs MDAnalysisTests
pytest --timeout=200 -n auto --pyargs MDAnalysisTests
pypi-latest-release:
# A set of runner to check that the latest conda release works as expected
Expand All @@ -268,9 +268,9 @@ jobs:
- name: install_mdanalysis
shell: bash
run: |
pip install mdanalysis mdanalysistests pytest-xdist "gsd<3.0"
pip install mdanalysis mdanalysistests pytest-xdist pytest-timeout "gsd<3.0"
- name: run_tests
shell: bash
run: |
pytest -n auto --pyargs MDAnalysisTests
pytest --timeout=200 -n auto --pyargs MDAnalysisTests
8 changes: 4 additions & 4 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
main_tests:
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ${{ matrix.os }}
timeout-minutes: 120
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
PYTEST_FLAGS="${PYTEST_FLAGS} --cov-config=.coveragerc --cov=MDAnalysis --cov-report=xml"
fi
echo $PYTEST_FLAGS
pytest -n auto testsuite/MDAnalysisTests $PYTEST_FLAGS
pytest -n auto --timeout=200 testsuite/MDAnalysisTests $PYTEST_FLAGS
- name: run_asv
if: contains(matrix.name, 'asv_check')
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
- name: install_deps
run: |
python -m pip install -U pip pipx wheel build
python -m pip install twine "readme-renderer>=34.0" pytest-xdist
python -m pip install twine "readme-renderer>=34.0" pytest-xdist pytest-timeout
- name: build_package_sdist
run: |
Expand Down Expand Up @@ -260,4 +260,4 @@ jobs:
- name: run tests
working-directory: ./dist
run: python -m pytest -n auto --pyargs MDAnalysisTests
run: python -m pytest --timeout=200 -n auto --pyargs MDAnalysisTests
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
packaging
pytest
pytest-cov
pytest-timeout
pytest-xdist
scikit-learn
tqdm
Expand Down Expand Up @@ -129,7 +130,7 @@ jobs:
condition: and(succeeded(), eq(variables['BUILD_TYPE'], 'normal'))
- powershell: |
cd testsuite
pytest MDAnalysisTests --disable-pytest-warnings -n 2 -rsx --cov=MDAnalysis
pytest MDAnalysisTests --disable-pytest-warnings -n auto --timeout=200 -rsx --cov=MDAnalysis
displayName: 'Run MDAnalysis Test Suite'
- script: |
curl -s https://codecov.io/bash | bash
Expand Down
8 changes: 4 additions & 4 deletions maintainer/ci/cirrus-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ linux_aarch64_task:
source mda-dev/bin/activate
python3 -m pip install ./package
python3 -m pip install ./testsuite
python3 -m pip install pytest-xdist
python3 -m pytest -n 8 ./testsuite/MDAnalysisTests
python3 -m pip install pytest-xdist pytest-timeout
python3 -m pytest --timeout=200 -n 8 ./testsuite/MDAnalysisTests
macos_arm64_task:
Expand All @@ -27,5 +27,5 @@ macos_arm64_task:
python -m pip install .
cd ../testsuite
python -m pip install .
python -m pip install pytest pytest-xdist
python -m pytest -n auto MDAnalysisTests
python -m pip install pytest pytest-xdist pytest-timeout
python -m pytest --timeout=200 -n auto MDAnalysisTests

0 comments on commit 66a2b21

Please sign in to comment.