From e1cafe642a5e7d265d7b1dc55e2ddda81d219377 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Thu, 27 Jul 2023 23:40:54 -0700 Subject: [PATCH] python3.pkgs.build: move tests to passthru While build is built using bootstrap packages, none of its test dependencies should be, so we must move out of the derivation. --- .../python-modules/build/default.nix | 71 ++++++++++++------- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/pkgs/development/python-modules/build/default.nix b/pkgs/development/python-modules/build/default.nix index 0eaad47c44f0..f86f47e2bd85 100644 --- a/pkgs/development/python-modules/build/default.nix +++ b/pkgs/development/python-modules/build/default.nix @@ -1,5 +1,6 @@ { lib , stdenv +, build , buildPythonPackage , fetchFromGitHub , flit-core @@ -41,36 +42,52 @@ buildPythonPackage rec { tomli ]; - nativeCheckInputs = [ - filelock - pytest-mock - pytest-rerunfailures - pytest-xdist - pytestCheckHook - setuptools - toml - ]; + # We need to disable tests because this package is part of the bootstrap chain + # and its test dependencies cannot be built yet when this is being built. + doCheck = false; - pytestFlagsArray = [ - "-W" - "ignore::DeprecationWarning" - ]; + passthru.tests = { + pytest = buildPythonPackage { + pname = "${pname}-pytest"; + inherit version; + format = "other"; - __darwinAllowLocalNetworking = true; + dontBuild = true; + dontInstall = true; - disabledTests = [ - # Tests often fail with StopIteration - "test_isolat" - "test_default_pip_is_never_too_old" - "test_build" - "test_with_get_requires" - "test_init" - "test_output" - "test_wheel_metadata" - ] ++ lib.optionals stdenv.isDarwin [ - # Expects Apple's Python and its quirks - "test_can_get_venv_paths_with_conflicting_default_scheme" - ]; + nativeCheckInputs = [ + build + filelock + pytest-mock + pytest-rerunfailures + pytest-xdist + pytestCheckHook + setuptools + toml + ]; + + pytestFlagsArray = [ + "-W" + "ignore::DeprecationWarning" + ]; + + __darwinAllowLocalNetworking = true; + + disabledTests = [ + # Tests often fail with StopIteration + "test_isolat" + "test_default_pip_is_never_too_old" + "test_build" + "test_with_get_requires" + "test_init" + "test_output" + "test_wheel_metadata" + ] ++ lib.optionals stdenv.isDarwin [ + # Expects Apple's Python and its quirks + "test_can_get_venv_paths_with_conflicting_default_scheme" + ]; + }; + }; pythonImportsCheck = [ "build"