From 349f57fb426225483f12e082e5ab5da8137eefe8 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Thu, 27 Jul 2023 23:39:40 -0700 Subject: [PATCH] python3.pkgs.pyproject-hooks: move tests to passthru While pyproject-hooks is built using bootstrap packages, none of its test dependencies should be, so we must move out of the derivation. --- .../pyproject-hooks/default.nix | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/pyproject-hooks/default.nix b/pkgs/development/python-modules/pyproject-hooks/default.nix index d751160b54d8..3624b5f02edb 100644 --- a/pkgs/development/python-modules/pyproject-hooks/default.nix +++ b/pkgs/development/python-modules/pyproject-hooks/default.nix @@ -2,6 +2,7 @@ , buildPythonPackage , fetchPypi , flit-core +, pyproject-hooks , pytestCheckHook , pythonOlder , setuptools @@ -30,17 +31,33 @@ buildPythonPackage rec { tomli ]; - nativeCheckInputs = [ - pytestCheckHook - setuptools - testpath - ]; + # 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; - disabledTests = [ - # fail to import setuptools - "test_setup_py" - "test_issue_104" - ]; + passthru.tests = { + pytest = buildPythonPackage { + pname = "${pname}-pytest"; + inherit version; + format = "other"; + + dontBuild = true; + dontInstall = true; + + nativeCheckInputs = [ + pyproject-hooks + pytestCheckHook + setuptools + testpath + ]; + + disabledTests = [ + # fail to import setuptools + "test_setup_py" + "test_issue_104" + ]; + }; + }; pythonImportsCheck = [ "pyproject_hooks"