From 6322dd1c858b1b0184b90596f921c9056b7515be Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Tue, 8 Apr 2025 09:28:01 +0200 Subject: [PATCH 1/2] python3Packages.pytest-retry: init at 1.7.0 --- .../python-modules/pytest-retry/default.nix | 40 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/python-modules/pytest-retry/default.nix diff --git a/pkgs/development/python-modules/pytest-retry/default.nix b/pkgs/development/python-modules/pytest-retry/default.nix new file mode 100644 index 000000000000..599e06e1fc99 --- /dev/null +++ b/pkgs/development/python-modules/pytest-retry/default.nix @@ -0,0 +1,40 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pytest, + pytestCheckHook, + setuptools, +}: + +buildPythonPackage rec { + pname = "pytest-retry"; + version = "1.7.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "str0zzapreti"; + repo = "pytest-retry"; + tag = version; + hash = "sha256-Gf+L7zvC1FGAm0Wd6E6fV3KynassoGyHSD0CPgEJ02k="; + }; + + build-system = [ setuptools ]; + + dependencies = [ pytest ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + pythonImportsCheck = [ "pytest_retry" ]; + + meta = { + description = "Plugin for retrying flaky tests in CI environments"; + longDescription = '' + This plugin adds a decorator to mark tests as flaky: `@pytest.mark.flaky(retries=3, delay=1)`. + ''; + homepage = "https://github.com/str0zzapreti/pytest-retry"; + changelog = "https://github.com/str0zzapreti/pytest-retry/releases/tag/${src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ fliegendewurst ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 442976c40a3b..fda2924fdedb 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13649,6 +13649,8 @@ self: super: with self; { pytest-responses = callPackage ../development/python-modules/pytest-responses { }; + pytest-retry = callPackage ../development/python-modules/pytest-retry { }; + pytest-reverse = callPackage ../development/python-modules/pytest-reverse { }; pytest-ruff = callPackage ../development/python-modules/pytest-ruff { }; From ba200968e8c797ba014b6df71d35d7a6498d18b9 Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Tue, 8 Apr 2025 09:28:01 +0200 Subject: [PATCH 2/2] python3Packages.debugpy: use retry plugin Otherwise the tests complete with warnings about an unknown decorator. --- pkgs/development/python-modules/debugpy/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/debugpy/default.nix b/pkgs/development/python-modules/debugpy/default.nix index 27b586407015..4204e22f4ce1 100644 --- a/pkgs/development/python-modules/debugpy/default.nix +++ b/pkgs/development/python-modules/debugpy/default.nix @@ -11,6 +11,7 @@ pytestCheckHook, pytest-xdist, pytest-timeout, + pytest-retry, importlib-metadata, psutil, untangle, @@ -99,6 +100,7 @@ buildPythonPackage rec { pytestCheckHook pytest-xdist pytest-timeout + pytest-retry ## Used by test helpers: importlib-metadata @@ -129,7 +131,12 @@ buildPythonPackage rec { ''; # Override default arguments in pytest.ini - pytestFlagsArray = [ "--timeout=0" ]; + pytestFlags = [ "--timeout=0" ]; + + disabledTests = [ + # hanging test (flaky) + "test_systemexit" + ]; # Fixes hanging tests on Darwin __darwinAllowLocalNetworking = true;