From 67564e09a539eeb63fde4197ad24c441e8408b73 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Thu, 23 Jan 2025 16:37:21 +0800 Subject: [PATCH] buildPython*: pass check-related args whenever specified Pass - disabledTestMarks - disabledTestPaths - disabledTests - enabledTestMarks - enabledTestPaths - enabledTests - pytestFlags - pytestFlagsArray - unittestFlags - unittestFlagsArray whenever they are specified, no matter if doCheck is true or if they are empty lists. Simplify the buildPython* argument handling and bring us closer to the deprecation of overridePythonAttrs and the adoption of fixed-point arguments. --- .../python/mk-python-derivation.nix | 51 ++++++------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index b5aa006ba212..5f7c3b03ca26 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -106,16 +106,6 @@ let "doInstallCheck" "pyproject" "format" - "disabledTestMarks" - "disabledTestPaths" - "disabledTests" - "enabledTestMarks" - "enabledTestPaths" - "enabledTests" - "pytestFlags" - "pytestFlagsArray" - "unittestFlags" - "unittestFlagsArray" "outputs" "stdenv" "dependencies" @@ -441,32 +431,21 @@ let # Longer-term we should get rid of `checkPhase` and use `installCheckPhase`. installCheckPhase = attrs.checkPhase; } - // optionalAttrs (attrs.doCheck or true) ( - getOptionalAttrs [ - "disabledTestMarks" - "disabledTestPaths" - "disabledTests" - "pytestFlags" - "pytestFlagsArray" - "unittestFlags" - "unittestFlagsArray" - ] attrs - // - lib.mapAttrs - ( - name: value: - lib.throwIf ( - attrs.${name} == [ ] - ) "${lib.getName finalAttrs}: ${name} must be unspecified, null or a non-empty list." attrs.${name} - ) - ( - getOptionalAttrs [ - "enabledTestMarks" - "enabledTestPaths" - "enabledTests" - ] attrs - ) - ) + // + lib.mapAttrs + ( + name: value: + lib.throwIf ( + attrs.${name} == [ ] + ) "${lib.getName finalAttrs}: ${name} must be unspecified, null or a non-empty list." attrs.${name} + ) + ( + getOptionalAttrs [ + "enabledTestMarks" + "enabledTestPaths" + "enabledTests" + ] attrs + ) ); # This derivation transformation function must be independent to `attrs`