From 53227486a66aba739cd242481d607a243e03bc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Thu, 22 Aug 2024 15:14:55 -0700 Subject: [PATCH 1/2] python312Packages.cookiecutter: run tests --- .../python-modules/cookiecutter/default.nix | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/cookiecutter/default.nix b/pkgs/development/python-modules/cookiecutter/default.nix index 5402b1764b00..8434666999b8 100644 --- a/pkgs/development/python-modules/cookiecutter/default.nix +++ b/pkgs/development/python-modules/cookiecutter/default.nix @@ -3,13 +3,13 @@ buildPythonPackage, fetchPypi, isPyPy, + bash, setuptools, - pytest, - pytest-cov, + pytestCheckHook, + pytest-cov-stub, pytest-mock, freezegun, - safety, - pre-commit, + git, jinja2, binaryornot, click, @@ -34,17 +34,24 @@ buildPythonPackage rec { hash = "sha256-2yH4Fp6k9P3CQI1IykSFk0neJkf75JSp1sPt/AVCwhw="; }; - nativeBuildInputs = [ setuptools ]; + postPatch = '' + patchShebangs tests/test-pyshellhooks/hooks tests/test-shellhooks/hooks + + substituteInPlace tests/test_hooks.py \ + --replace-fail "/bin/bash" "${lib.getExe bash}" + ''; + + build-system = [ setuptools ]; nativeCheckInputs = [ - pytest - pytest-cov + pytestCheckHook + pytest-cov-stub pytest-mock freezegun - safety - pre-commit + git ]; - propagatedBuildInputs = [ + + dependencies = [ binaryornot jinja2 click @@ -56,12 +63,17 @@ buildPythonPackage rec { rich ]; - # requires network access for cloning git repos - doCheck = false; - checkPhase = '' - pytest + pythonImportsCheck = [ "cookiecutter.main" ]; + + preCheck = '' + export HOME="$(mktemp -d)" ''; + disabledTests = [ + # messes with $PYTHONPATH + "test_should_invoke_main" + ]; + meta = with lib; { homepage = "https://github.com/audreyr/cookiecutter"; description = "Command-line utility that creates projects from project templates"; From f539a50f5697d52d6321389d2fe7df1ab1727ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Thu, 22 Aug 2024 15:19:08 -0700 Subject: [PATCH 2/2] python312Packages.cookiecutter: add meta.changelog --- pkgs/development/python-modules/cookiecutter/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/python-modules/cookiecutter/default.nix b/pkgs/development/python-modules/cookiecutter/default.nix index 8434666999b8..d4071552f112 100644 --- a/pkgs/development/python-modules/cookiecutter/default.nix +++ b/pkgs/development/python-modules/cookiecutter/default.nix @@ -76,6 +76,7 @@ buildPythonPackage rec { meta = with lib; { homepage = "https://github.com/audreyr/cookiecutter"; + changelog = "https://github.com/cookiecutter/cookiecutter/blob/${version}/HISTORY.md"; description = "Command-line utility that creates projects from project templates"; mainProgram = "cookiecutter"; license = licenses.bsd3;