about summary refs log tree commit diff
path: root/pkgs/development/interpreters/python
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2024-01-09 17:46:49 +0000
committerGitHub <noreply@github.com>2024-01-09 18:46:49 +0100
commitc64c04e8bf17967aecce87a9389b062ae3ee749b (patch)
treea9c178af5c283d0f3fef199e0d925af57ddda8b5 /pkgs/development/interpreters/python
parenta6671578ffa6336bfd1238f1b2a00662b5ab1b34 (diff)
downloadnixlib-c64c04e8bf17967aecce87a9389b062ae3ee749b.tar
nixlib-c64c04e8bf17967aecce87a9389b062ae3ee749b.tar.gz
nixlib-c64c04e8bf17967aecce87a9389b062ae3ee749b.tar.bz2
nixlib-c64c04e8bf17967aecce87a9389b062ae3ee749b.tar.lz
nixlib-c64c04e8bf17967aecce87a9389b062ae3ee749b.tar.xz
nixlib-c64c04e8bf17967aecce87a9389b062ae3ee749b.tar.zst
nixlib-c64c04e8bf17967aecce87a9389b062ae3ee749b.zip
pythonInterpreters.pypy39_prebuilt: fix `tests` eval (#278950)
Without the change `test-pythonPackagesExtensions` test fails the eval
as:

    $ nix build -f. pythonInterpreters.pypy39_prebuilt.tests --show-trace
    error:
       … while evaluating an attribute name
         at pkgs/development/interpreters/python/tests.nix:151:16:
          150|       });
          151|     in pkgs_.${python.pythonAttr}.pkgs.foo;
             |                ^
          152|   });

       error: value is null while a string was expected

This happens because `pypy39_prebuilt` exposes `pythonAttr` attribute,
but it has a `null` value. Fix the test to filter out prebuilt pypy.
Diffstat (limited to 'pkgs/development/interpreters/python')
-rw-r--r--pkgs/development/interpreters/python/tests.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/python/tests.nix b/pkgs/development/interpreters/python/tests.nix
index 67670ceb6546..df4484f9ec68 100644
--- a/pkgs/development/interpreters/python/tests.nix
+++ b/pkgs/development/interpreters/python/tests.nix
@@ -125,6 +125,9 @@ let
     extension = self: super: {
       foobar = super.numpy;
     };
+    # `pythonInterpreters.pypy39_prebuilt` does not expose an attribute
+    # name (is not present in top-level `pkgs`).
+    is_prebuilt = python: python.pythonAttr == null;
   in lib.optionalAttrs (python.isPy3k) ({
     test-packageOverrides = let
       myPython = let
@@ -138,7 +141,10 @@ let
     # test-overrideScope = let
     #  myPackages = python.pkgs.overrideScope extension;
     # in assert myPackages.foobar == myPackages.numpy; myPackages.python.withPackages(ps: with ps; [ foobar ]);
-  } // lib.optionalAttrs (python ? pythonAttr) {
+    #
+    # Have to skip prebuilt python as it's not present in top-level
+    # `pkgs` as an attribute.
+  } // lib.optionalAttrs (python ? pythonAttr && !is_prebuilt python) {
     # Test applying overrides using pythonPackagesOverlays.
     test-pythonPackagesExtensions = let
       pkgs_ = pkgs.extend(final: prev: {