From 85b2818ea00905603e711fbf28e959469edd7ba0 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 26 Feb 2025 16:34:55 -0300 Subject: [PATCH] ci: Add pytest-rerunfailures for improved test reliability (#6852) * chore: Add pytest-rerunfailures plugin for test reliability * ci: Update unit tests workflow with pytest-rerunfailures --- .github/workflows/python_test.yml | 2 +- pyproject.toml | 1 + uv.lock | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python_test.yml b/.github/workflows/python_test.yml index 66ed1b5d8..26f5621cb 100644 --- a/.github/workflows/python_test.yml +++ b/.github/workflows/python_test.yml @@ -60,7 +60,7 @@ jobs: with: timeout_minutes: 12 max_attempts: 2 - command: make unit_tests async=false args="-x -vv --splits ${{ matrix.splitCount }} --group ${{ matrix.group }}" + command: make unit_tests args="-x -vv --splits ${{ matrix.splitCount }} --group ${{ matrix.group }} --reruns 5" - name: Minimize uv cache run: uv cache prune --ci integration-tests: diff --git a/pyproject.toml b/pyproject.toml index 2d96e389c..7cdc279a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -155,6 +155,7 @@ dev = [ "codeflash>=0.8.4", "hypothesis>=6.123.17", "locust>=2.32.9", + "pytest-rerunfailures>=15.0", ] [tool.uv.sources] diff --git a/uv.lock b/uv.lock index a997c68e2..25d56c54e 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,4 @@ version = 1 -revision = 1 requires-python = ">=3.10, <3.14" resolution-markers = [ "python_full_version >= '3.13'", @@ -4386,6 +4385,7 @@ dev = [ { name = "pytest-instafail" }, { name = "pytest-mock" }, { name = "pytest-profiling" }, + { name = "pytest-rerunfailures" }, { name = "pytest-split" }, { name = "pytest-sugar" }, { name = "pytest-xdist" }, @@ -4514,7 +4514,6 @@ requires-dist = [ { name = "youtube-transcript-api", specifier = "==0.6.3" }, { name = "zep-python", specifier = "==2.0.2" }, ] -provides-extras = ["deploy", "couchbase", "cassio", "local", "clickhouse-connect", "nv-ingest"] [package.metadata.requires-dev] dev = [ @@ -4539,6 +4538,7 @@ dev = [ { name = "pytest-instafail", specifier = ">=0.5.0" }, { name = "pytest-mock", specifier = ">=3.14.0" }, { name = "pytest-profiling", specifier = ">=1.7.0" }, + { name = "pytest-rerunfailures", specifier = ">=15.0" }, { name = "pytest-split", specifier = ">=0.9.0" }, { name = "pytest-sugar", specifier = ">=1.0.0" }, { name = "pytest-xdist", specifier = ">=3.6.0" }, @@ -4765,7 +4765,6 @@ requires-dist = [ { name = "uvicorn", specifier = ">=0.30.0,<1.0.0" }, { name = "validators", specifier = ">=0.34.0" }, ] -provides-extras = ["deploy", "local", "all"] [package.metadata.requires-dev] dev = [ @@ -7658,6 +7657,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e3/ac/c428c66241a144617a8af7a28e2e055e1438d23b949b62ac4b401a69fb79/pytest_profiling-1.8.1-py3-none-any.whl", hash = "sha256:3dd8713a96298b42d83de8f5951df3ada3e61b3e5d2a06956684175529e17aea", size = 9929 }, ] +[[package]] +name = "pytest-rerunfailures" +version = "15.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "packaging" }, + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/26/47/ec4e12f45f4b9fac027a41ccaabb353ed4f23695aae860258ba11a84ed9b/pytest-rerunfailures-15.0.tar.gz", hash = "sha256:2d9ac7baf59f4c13ac730b47f6fa80e755d1ba0581da45ce30b72fb3542b4474", size = 21816 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/89/37/54e5ffc7c0cebee7cf30a3ac5915faa7e7abf8bdfdf3228c277f7c192489/pytest_rerunfailures-15.0-py3-none-any.whl", hash = "sha256:dd150c4795c229ef44320adc9a0c0532c51b78bb7a6843a8c53556b9a611df1a", size = 13017 }, +] + [[package]] name = "pytest-socket" version = "0.7.0"