Overriding `doCheck` doesn't work with python package

I have a simple nix-shell file:

let
  # From https://github.com/NixOS/nixpkgs/pull/134894.
  pkgs = import (fetchTarball("https://github.com/NixOS/nixpkgs/archive/a16117f1c042d4772d750077fa3c21421cf4a199.tar.gz")) {};
in pkgs.mkShell {
  buildInputs = with pkgs; [
    (python3Packages.jax.overrideAttrs (_: { doCheck = false; }))
  ];
}

The tests take a little while to run, so I’d like to skip them for convenience. However overrideAttrs with doCheck = false; doesn’t seem to have any effect… It still runs the test suite.

How can I override the derivation to skip the test suite?

You’re looking for overridePythonAttrs, the checkPhase declared in a buildPythonPackage maps to a installCheckPhase in mkDerivation. The reason for this, is that packages with native extensions can only be installed, and are not represented in the build directory.

2 Likes

Ah gotcha, thank you! I had no idea about overridePythonAttrs!