automatically re-run flaky tests

This commit is contained in:
Gabriel Augendre 2024-02-04 00:19:58 +01:00
parent bbbcd4730c
commit 0a4e0547ca
4 changed files with 11 additions and 0 deletions

View file

@ -50,6 +50,10 @@ testpaths = [
"src", "src",
] ]
markers = [
"flaky",
]
############################################################################### ###############################################################################
# ruff # ruff
############################################################################### ###############################################################################

View file

@ -4,6 +4,7 @@ pytest>=6.0
pytest-cov>=3.0.0 pytest-cov>=3.0.0
pytest-django>=4.5.0 pytest-django>=4.5.0
pytest-selenium>=4.0.0 pytest-selenium>=4.0.0
pytest-rerunfailures>=13.0
pre-commit>=2.7 pre-commit>=2.7
model-bakery>=1.1 model-bakery>=1.1
invoke>=2.0.0 invoke>=2.0.0

View file

@ -78,6 +78,7 @@ packaging==23.2
# black # black
# build # build
# pytest # pytest
# pytest-rerunfailures
pathspec==0.12.1 pathspec==0.12.1
# via black # via black
pip-tools==7.3.0 pip-tools==7.3.0
@ -102,6 +103,7 @@ pytest==7.4.4
# pytest-django # pytest-django
# pytest-html # pytest-html
# pytest-metadata # pytest-metadata
# pytest-rerunfailures
# pytest-selenium # pytest-selenium
# pytest-variables # pytest-variables
pytest-base-url==2.0.0 pytest-base-url==2.0.0
@ -114,6 +116,8 @@ pytest-html==4.1.1
# via pytest-selenium # via pytest-selenium
pytest-metadata==3.0.0 pytest-metadata==3.0.0
# via pytest-html # via pytest-html
pytest-rerunfailures==13.0
# via -r requirements-dev.in
pytest-selenium==4.0.2 pytest-selenium==4.0.2
# via -r requirements-dev.in # via -r requirements-dev.in
pytest-variables==3.0.0 pytest-variables==3.0.0

View file

@ -1,6 +1,7 @@
import time import time
import freezegun import freezegun
import pytest
from django.urls import reverse from django.urls import reverse
from pytest_django.live_server_helper import LiveServer from pytest_django.live_server_helper import LiveServer
from selenium.webdriver import ActionChains, Keys from selenium.webdriver import ActionChains, Keys
@ -20,6 +21,7 @@ from purchase.tests.factories import (
) )
@pytest.mark.flaky(reruns=5)
@freezegun.freeze_time("2022-09-24 19:01:00+0200") @freezegun.freeze_time("2022-09-24 19:01:00+0200")
def test_cashier_create_and_update_basket( # noqa: PLR0915 def test_cashier_create_and_update_basket( # noqa: PLR0915
live_server: LiveServer, live_server: LiveServer,