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.
This commit is contained in:
Sergei Trofimovich 2024-01-09 17:46:49 +00:00 committed by GitHub
parent a6671578ff
commit c64c04e8bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: {