From 00b1ba422859f7be7cd267aa1eb90f88f3d360de Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 27 Apr 2026 02:44:48 +0800 Subject: [PATCH 1/2] python3Packages: transition from pytestFlagsArray (round 3) --- pkgs/by-name/kh/khard/package.nix | 2 +- pkgs/by-name/op/openfreebuds/package.nix | 2 +- pkgs/by-name/yb/yb/package.nix | 2 +- pkgs/development/python-modules/connect-box/default.nix | 5 ++--- pkgs/development/python-modules/country-list/default.nix | 2 +- pkgs/development/python-modules/crewai/default.nix | 2 +- pkgs/development/python-modules/django-jinja/default.nix | 2 +- pkgs/development/python-modules/scanpy/default.nix | 2 +- pkgs/development/python-modules/sklearn2pmml/default.nix | 2 +- .../python-modules/tree-sitter-language-pack/default.nix | 2 +- 10 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/by-name/kh/khard/package.nix b/pkgs/by-name/kh/khard/package.nix index be52eab3c6d2..5adfdb61364e 100644 --- a/pkgs/by-name/kh/khard/package.nix +++ b/pkgs/by-name/kh/khard/package.nix @@ -60,7 +60,7 @@ python3.pkgs.buildPythonApplication (finalAttrs: { python3.pkgs.pytestCheckHook ]; - pytestFlagsArray = [ + pytestFlags = [ # Nixpkgs' default is `--capture=fd`, and with it, 2 command mock tests # fail, see: https://github.com/lucc/khard/issues/353 "--capture=no" diff --git a/pkgs/by-name/op/openfreebuds/package.nix b/pkgs/by-name/op/openfreebuds/package.nix index b0f5c07e8b77..29fd14b2a4e0 100644 --- a/pkgs/by-name/op/openfreebuds/package.nix +++ b/pkgs/by-name/op/openfreebuds/package.nix @@ -38,7 +38,7 @@ python3Packages.buildPythonApplication (finalAttrs: { pytestCheckHook ]; - pytestFlagsArray = [ + enabledTestPaths = [ "openfreebuds/driver/huawei/test/" "openfreebuds/test/test_event_bus.py" ]; diff --git a/pkgs/by-name/yb/yb/package.nix b/pkgs/by-name/yb/yb/package.nix index ad9cbfe8cd81..b96acb2db702 100644 --- a/pkgs/by-name/yb/yb/package.nix +++ b/pkgs/by-name/yb/yb/package.nix @@ -66,7 +66,7 @@ python3Packages.buildPythonApplication (finalAttrs: { # Run subset of tests that don't require YubiKey hardware doCheck = true; - pytestFlagsArray = [ + enabledTestPaths = [ "tests" ]; diff --git a/pkgs/development/python-modules/connect-box/default.nix b/pkgs/development/python-modules/connect-box/default.nix index 3376f3ea67ed..f34d7dbc1ba4 100644 --- a/pkgs/development/python-modules/connect-box/default.nix +++ b/pkgs/development/python-modules/connect-box/default.nix @@ -41,10 +41,9 @@ buildPythonPackage rec { pythonImportsCheck = [ "connect_box" ]; - pytestFlagsArray = [ + pytestFlags = [ "--vcr-record=none" - "-W" - "ignore::DeprecationWarning" + "-Wignore::DeprecationWarning" ]; meta = { diff --git a/pkgs/development/python-modules/country-list/default.nix b/pkgs/development/python-modules/country-list/default.nix index 8e4ee9ab6d95..2a301e1f6c33 100644 --- a/pkgs/development/python-modules/country-list/default.nix +++ b/pkgs/development/python-modules/country-list/default.nix @@ -31,7 +31,7 @@ buildPythonPackage rec { pytestCheckHook ]; - pytestFlagsArray = [ + enabledTestPaths = [ "tests.py" ]; diff --git a/pkgs/development/python-modules/crewai/default.nix b/pkgs/development/python-modules/crewai/default.nix index 55cd5934cc11..307440f10bc7 100644 --- a/pkgs/development/python-modules/crewai/default.nix +++ b/pkgs/development/python-modules/crewai/default.nix @@ -552,7 +552,7 @@ buildPythonPackage (finalAttrs: { writableTmpDirAsHomeHook ]; - pytestFlagsArray = [ + pytestFlags = [ "--override-ini=addopts=" ]; diff --git a/pkgs/development/python-modules/django-jinja/default.nix b/pkgs/development/python-modules/django-jinja/default.nix index 20f88ca5ac2c..b48a32ee4ae8 100644 --- a/pkgs/development/python-modules/django-jinja/default.nix +++ b/pkgs/development/python-modules/django-jinja/default.nix @@ -44,7 +44,7 @@ buildPythonPackage rec { export DJANGO_SETTINGS_MODULE=settings ''; - pytestFlagsArray = [ + enabledTestPaths = [ "testapp/tests.py" ]; diff --git a/pkgs/development/python-modules/scanpy/default.nix b/pkgs/development/python-modules/scanpy/default.nix index 1bb17259226a..cad855c690a3 100644 --- a/pkgs/development/python-modules/scanpy/default.nix +++ b/pkgs/development/python-modules/scanpy/default.nix @@ -180,7 +180,7 @@ buildPythonPackage (finalAttrs: { export NUMBA_CACHE_DIR=$(mktemp -d); ''; - pytestFlagsArray = [ + pytestFlags = [ # UserWarning: 'where' used without 'out', expect unitialized memory in output. # If this is intentional, use out=None. "-Wignore::UserWarning" diff --git a/pkgs/development/python-modules/sklearn2pmml/default.nix b/pkgs/development/python-modules/sklearn2pmml/default.nix index 93e1e83c9485..53dea7d9bfa8 100644 --- a/pkgs/development/python-modules/sklearn2pmml/default.nix +++ b/pkgs/development/python-modules/sklearn2pmml/default.nix @@ -66,7 +66,7 @@ buildPythonPackage (finalAttrs: { statsmodels ]; - pytestFlagsArray = [ + enabledTestPaths = [ # Only run the main test suite; subpackage tests require # sklearn-pandas which is not available in nixpkgs "sklearn2pmml/tests" diff --git a/pkgs/development/python-modules/tree-sitter-language-pack/default.nix b/pkgs/development/python-modules/tree-sitter-language-pack/default.nix index 090b6215651d..20e3c8d6f426 100644 --- a/pkgs/development/python-modules/tree-sitter-language-pack/default.nix +++ b/pkgs/development/python-modules/tree-sitter-language-pack/default.nix @@ -127,7 +127,7 @@ buildPythonPackage (finalAttrs: { EOF ''; - pytestFlagsArray = [ + enabledTestPaths = [ "e2e/python/tests" "tests/test_apps/python/smoke_test.py" ]; From 82da9cf45c21f9b93b48d8ef40ff6005dfc5a53b Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 27 Apr 2026 03:13:53 +0800 Subject: [PATCH 2/2] python3Packages.buildPythonPackage: ban pytestFlagsArray --- doc/release-notes/rl-2605.section.md | 4 ++++ .../interpreters/python/mk-python-derivation.nix | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index 40f605b2315d..cb3c0f28d474 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -168,6 +168,10 @@ - the `xorg` package set has been deprecated, packages have moved to the top level. +- `python3Packages.buildPythonPackage` and `python3Packages.buildPythonApplication` now throw errors in the presence of `pytestFlagsArray`. + Please use [`pytestFlags` and `(enabled|disabled)(TestPaths|Tests|TestMarks)`](#using-pytestcheckhook) instead. + If modifying the Nix expression is not feasible, users can remediate the error by overriding `pytestFlagsArray` with `null` or `[ ]`. + - `python3Packages.pygame` has been been renamed to `python3Packages.pygame-original`, the attribute `python3Packages.pygame` will from python 3.14 default to the more actively maintained `python3Packages.pygame-ce` - `fastly` has been updated to major version 14. For more information, you can check the [release notes](https://github.com/fastly/cli/releases/tag/v14.0.0) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 5bbde1ab2f97..5f4ac7b84645 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -112,6 +112,9 @@ lib.extendMkDerivation { "dependencies" "optional-dependencies" "build-system" + + # Deprecated arguments + "pytestFlagsArray" ]; extendDrvArgs = @@ -439,6 +442,19 @@ lib.extendMkDerivation { # Longer-term we should get rid of `checkPhase` and use `installCheckPhase`. installCheckPhase = attrs.checkPhase; } + // ( + let + deprecatedFlagNotEmpty = + attrs ? pytestFlagsArray && attrs.pytestFlagsArray != null && attrs.pytestFlagsArray != [ ]; + pos = builtins.unsafeGetAttrPos "pytestFlagsArray" attrs; + in + { + ${if deprecatedFlagNotEmpty then "pytestFlagsArray" else null} = throw '' + buildPythonPackage: Deprecated flag pytestFlagsArray found at ${pos.file}:${toString pos.line} + Use pytestFlags or (enabled|disabled)(TestPaths|Tests|TestMarks) instead. + ''; + } + ) // lib.mapAttrs (