From 0a4e0547ca3f0aeb095c1ddd376a8fe55dbdedf7 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 4 Feb 2024 00:19:58 +0100 Subject: [PATCH] automatically re-run flaky tests --- pyproject.toml | 4 ++++ requirements-dev.in | 1 + requirements-dev.txt | 4 ++++ src/purchase/tests/test_cashier_flow.py | 2 ++ 4 files changed, 11 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 49d1b91..f32b785 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,10 @@ testpaths = [ "src", ] +markers = [ + "flaky", +] + ############################################################################### # ruff ############################################################################### diff --git a/requirements-dev.in b/requirements-dev.in index f92d149..693a6d9 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -4,6 +4,7 @@ pytest>=6.0 pytest-cov>=3.0.0 pytest-django>=4.5.0 pytest-selenium>=4.0.0 +pytest-rerunfailures>=13.0 pre-commit>=2.7 model-bakery>=1.1 invoke>=2.0.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index 1957cbe..22d92d8 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -78,6 +78,7 @@ packaging==23.2 # black # build # pytest + # pytest-rerunfailures pathspec==0.12.1 # via black pip-tools==7.3.0 @@ -102,6 +103,7 @@ pytest==7.4.4 # pytest-django # pytest-html # pytest-metadata + # pytest-rerunfailures # pytest-selenium # pytest-variables pytest-base-url==2.0.0 @@ -114,6 +116,8 @@ pytest-html==4.1.1 # via pytest-selenium pytest-metadata==3.0.0 # via pytest-html +pytest-rerunfailures==13.0 + # via -r requirements-dev.in pytest-selenium==4.0.2 # via -r requirements-dev.in pytest-variables==3.0.0 diff --git a/src/purchase/tests/test_cashier_flow.py b/src/purchase/tests/test_cashier_flow.py index 6364ec4..aa34ad4 100644 --- a/src/purchase/tests/test_cashier_flow.py +++ b/src/purchase/tests/test_cashier_flow.py @@ -1,6 +1,7 @@ import time import freezegun +import pytest from django.urls import reverse from pytest_django.live_server_helper import LiveServer 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") def test_cashier_create_and_update_basket( # noqa: PLR0915 live_server: LiveServer,