From da46e8557864c6ddbfe285d2af225640abd7d6d4 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Wed, 3 Jul 2024 22:33:52 +0200 Subject: [PATCH] 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. --- tox.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 0257a7b..64ac816 100644 --- a/tox.ini +++ b/tox.ini @@ -24,6 +24,7 @@ setenv = JUPYTER_DATA_DIR={envdir}/share/jupyter deps = pytest<8.0.0 + pytest-rerunfailures pytest-html<4.0.0, # selenium juypter notebook tests jupyterlab==3.6.5 @@ -41,7 +42,7 @@ deps = commands = # converts the python files to ipython notebooks jupytext tests/notebooks/*.py --to ipynb - pytest {posargs:-v} --driver Firefox + pytest {posargs:-v} --reruns 2 --driver Firefox [testenv:tests-lab-4] description = @@ -56,6 +57,7 @@ setenv = JUPYTER_DATA_DIR={envdir}/share/jupyter deps = pytest<8.0.0 + pytest-rerunfailures pytest-html<4.0.0, # selenium juypter notebook tests jupyterlab>=4.0.0 @@ -73,7 +75,7 @@ deps = commands = # converts the python files to ipython notebooks jupytext tests/notebooks/*.py --to ipynb - pytest {posargs:-v} -m "not matplotlib" --driver Firefox + pytest {posargs:-v} -m "not matplotlib" --reruns 2 --driver Firefox [testenv:coverage] # We do coverage in a separate environment that skips the selenium tests but