Skip to content

python3Packages.raylib-python-cffi.tests: fix the eval#480960

Merged
MattSturgeon merged 1 commit intoNixOS:masterfrom
trofi:python3Packages.raylib-python-cffi.tests-fix-eval
Jan 17, 2026
Merged

python3Packages.raylib-python-cffi.tests: fix the eval#480960
MattSturgeon merged 1 commit intoNixOS:masterfrom
trofi:python3Packages.raylib-python-cffi.tests-fix-eval

Conversation

@trofi
Copy link
Contributor

@trofi trofi commented Jan 17, 2026

Without the chnage the eval fails:

$ nix-instantiate -A python3Packages.raylib-python-cffi.tests
error:
   … from call site
     at pkgs/development/python-modules/raylib-python-cffi/default.nix:52:20:
       51|
       52|   passthru.tests = import ./passthru-tests.nix {
         |                    ^
       53|     inherit writers;

   error: function 'anonymous lambda' called without required argument 'src'
   at pkgs/development/python-modules/raylib-python-cffi/passthru-tests.nix:1:1:
        1| {
         | ^
        2|   src,

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 6.topic: python Python is a high-level, general-purpose programming language. labels Jan 17, 2026
@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jan 17, 2026
Without the chnage the eval fails:

    $ nix-instantiate -A python3Packages.raylib-python-cffi.tests
    error:
       … from call site
         at pkgs/development/python-modules/raylib-python-cffi/default.nix:52:20:
           51|
           52|   passthru.tests = import ./passthru-tests.nix {
             |                    ^
           53|     inherit writers;

       error: function 'anonymous lambda' called without required argument 'src'
       at pkgs/development/python-modules/raylib-python-cffi/passthru-tests.nix:1:1:
            1| {
             | ^
            2|   src,
@trofi trofi force-pushed the python3Packages.raylib-python-cffi.tests-fix-eval branch from bace3f9 to 77884b9 Compare January 17, 2026 10:57
@MattSturgeon
Copy link
Contributor

MattSturgeon commented Jan 17, 2026

As an FYI, this test could use some cleanup.

For example, this is IFD:

    } (builtins.readFile (src + path));

importing a file from inside the src derivation.

In this case, we don't need to read that file at eval time only to use it to create another derivation. Instead we can write a derivation that copies, symlinks, or directly references the relevant file at build time.

@MattSturgeon MattSturgeon added this pull request to the merge queue Jan 17, 2026
@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 17, 2026
Merged via the queue into NixOS:master with commit dff2312 Jan 17, 2026
31 of 33 checks passed
@trofi trofi deleted the python3Packages.raylib-python-cffi.tests-fix-eval branch January 17, 2026 12:19
@MattSturgeon
Copy link
Contributor

As an FYI, this test could use some cleanup.

For reference, the test was added in #387993 and hasn't been touched since.

In addition to the IFD issue mentioned in my last comment, AFAICT the tests don't actually test anything.1 All they do is repackage some scripts from src, without linting, running them, or doing any other build-time checks.

cc original author @Sigmanificient and reviewer @GaetanLepage

Footnotes

  1. Unless you run the result, which is not how passthru tests are expected to be used; usually a test failure should be a build failure, with no need to run the test's outputs.

@Sigmanificient
Copy link
Member

Sigmanificient commented Jan 17, 2026

Thanks for fixing this issue, i'm definitely not be best at doing nix 😅

@MattSturgeon I am opened for suggestions to improve theses tests, but I don't see anything other than going all in with a nixosTests + screenshot, which seems super heavy ...and still require you to actually check nothing has gone wrong. I also remember seeing this pattern within another package, so I'm pretty such this isn't the only package doing a test you need to actually run 🤔

writers,
}:
let
src = raylib-python-cffi.src;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More a curiosity question than anything, but would something like inherit (raylib-python-cffi) src; work or does it cause something weird to happen that I am unaware of?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, inherit (foo) bar and bar = foo.bar are exactly the same thing. I usually prefer the inherit style, but I try to avoid nitpicking such trivial details when I can restrain myself.

Copy link
Member

@Sigmanificient Sigmanificient Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is not to nitpick on this, just to know if there is some notable behavior! I do prefer the inherit style too, but this will go when the opportunity comes. I prefer to challenge my perception, in case i could be wrong :)

@MattSturgeon
Copy link
Contributor

I am opened for suggestions to improve theses tests, but I don't see anything other than going all in with a nixosTests + screenshot, which seems super heavy ...and still require you to actually check nothing has gone wrong. I also remember seeing this pattern within another package, so I'm pretty such this isn't the only package doing a test you need to actually run 🤔

I think half the issue is that it is unclear how you expect the tests to be used. If I see a package's passthru.tests built successfully, I assume the tests were successful and think no more of it.

When I read the test's impl I was super surprised to see them not validating anything, but instead just re-packaging some scripts from the package's src. I did guess that maybe you intended the test derivation's outputs to be actually ran, but that concept is so unusual it feels like a bug.


All of this is separate to the IFD issue; we should never import the content of derivation output files into a nix evaluation, because nixpkgs has a policy against IFD. It's less bad within passthru tests that aren't typically evaluated, but it is still totally unnecessary when re-packaging can be done in a build script (e.g. using runCommand).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants