Skip to content

Commit 1f22e67

Browse files
authored
Merge pull request #3152 from bsipocz/CI_rerun_failures
CI: rerun failed tests in a 2nd pytest run rather than immediately
2 parents 8cdb2df + 04c6069 commit 1f22e67

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tox.ini

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ description = run tests
2222

2323
setenv =
2424
PYTEST_ARGS = ''
25-
online: PYTEST_ARGS = --remote-data=any --reruns=1 --reruns-delay 10 -m "not bigdata"
25+
# We have two pytest runs for the online tests, need to suppress the failing status for the first one to be able to run the second.
26+
online: PYTEST_ARGS = --remote-data=any -P sdss -m "not bigdata" --suppress-tests-failed-exit-code
27+
online: PYTEST_ARGS_2 = --remote-data=any -vv -P sdss --last-failed -m "not bigdata"
28+
online: SINGLE_RUN = False
2629
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/scientific-python-nightly-wheels/simple https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple
2730
# astropy doesn't yet have a 3.13 compatible release
2831
py313: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple
@@ -53,7 +56,7 @@ deps =
5356
oldestdeps-alldeps: mocpy==0.9
5457
oldestdeps-alldeps: regions==0.5
5558

56-
online: pytest-rerunfailures
59+
online: pytest-custom_exit_code
5760

5861
extras =
5962
test
@@ -67,6 +70,10 @@ commands =
6770
python -m pip freeze
6871
!cov: pytest --pyargs astroquery {toxinidir}/docs {env:PYTEST_ARGS} {posargs}
6972
cov: pytest --pyargs astroquery {toxinidir}/docs --cov astroquery --cov-config={toxinidir}/setup.cfg {env:PYTEST_ARGS} {posargs}
73+
# For remote tests, we re-run the failures to filter out at least some of the flaky ones.
74+
# We use a second pytest run with --last-failed as opposed to --rerun in order to rerun the
75+
# failed ones at the end rather than right away.
76+
online: pytest --pyargs astroquery {toxinidir}/docs {env:PYTEST_ARGS_2} {posargs}
7077
cov: coverage xml -o {toxinidir}/coverage.xml
7178

7279
pip_pre =

0 commit comments

Comments
 (0)