Skip to content

Commit 4116bd9

Browse files
committed
Tests: Add rerun functionality for tests
We add pytest-rerun to tests and allow the tests to be rerun up to 3 times until they pass. The tests for lab 4 are less stable and fail at different points for different reasons that are hard to fix. By allowing the tests to pass with a rerun we avoid these kind of issues.
1 parent 26697eb commit 4116bd9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tox.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ setenv =
2424
JUPYTER_DATA_DIR={envdir}/share/jupyter
2525
deps =
2626
pytest<8.0.0
27+
pytest-rerunfailures
2728
pytest-html<4.0.0,
2829
# selenium juypter notebook tests
2930
jupyterlab==3.6.5
@@ -41,7 +42,7 @@ deps =
4142
commands =
4243
# converts the python files to ipython notebooks
4344
jupytext tests/notebooks/*.py --to ipynb
44-
pytest {posargs:-v} --driver Firefox
45+
pytest {posargs:-v} --reruns 2 --driver Firefox
4546

4647
[testenv:tests-lab-4]
4748
description =
@@ -56,6 +57,7 @@ setenv =
5657
JUPYTER_DATA_DIR={envdir}/share/jupyter
5758
deps =
5859
pytest<8.0.0
60+
pytest-rerunfailures
5961
pytest-html<4.0.0,
6062
# selenium juypter notebook tests
6163
jupyterlab>=4.0.0
@@ -73,7 +75,7 @@ deps =
7375
commands =
7476
# converts the python files to ipython notebooks
7577
jupytext tests/notebooks/*.py --to ipynb
76-
pytest {posargs:-v} -m "not matplotlib" --driver Firefox
78+
pytest {posargs:-v} -m "not matplotlib" --reruns 2 --driver Firefox
7779

7880
[testenv:coverage]
7981
# We do coverage in a separate environment that skips the selenium tests but

0 commit comments

Comments
 (0)