From 0ceee835407d6dc6b430a97a09a7fd7d2eb792f7 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Sat, 19 Aug 2023 02:26:37 -0700 Subject: [PATCH] pipenv: remove wheel install test, enable unit tests --- pkgs/development/tools/pipenv/default.nix | 47 ++++++++++++++++------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/pkgs/development/tools/pipenv/default.nix b/pkgs/development/tools/pipenv/default.nix index 0e73b5ee3b60..c8e4d0e20069 100644 --- a/pkgs/development/tools/pipenv/default.nix +++ b/pkgs/development/tools/pipenv/default.nix @@ -1,7 +1,7 @@ { lib , stdenv , python3 -, fetchPypi +, fetchFromGitHub , installShellFiles }: @@ -25,15 +25,22 @@ let in buildPythonApplication rec { pname = "pipenv"; version = "2023.2.4"; + format = "pyproject"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-GKPrpRnjbVnw1af5xCvSaFIeS5t7PRvWrc8TFWkyMnU="; + src = fetchFromGitHub { + owner = "pypa"; + repo = "pipenv"; + rev = "refs/tags/v${version}"; + hash = "sha256-jZOBu4mWyu8U6CGqtYgfcCCDSa0pGqoZEFnXl5IO+JY="; }; - LC_ALL = "en_US.UTF-8"; + env.LC_ALL = "en_US.UTF-8"; - nativeBuildInputs = [ installShellFiles ]; + nativeBuildInputs = [ + installShellFiles + setuptools + wheel + ]; postPatch = '' # pipenv invokes python in a subprocess to create a virtualenv @@ -46,6 +53,27 @@ in buildPythonApplication rec { propagatedBuildInputs = runtimeDeps python3.pkgs; + preCheck = '' + export HOME="$TMPDIR" + ''; + + nativeCheckInputs = [ + mock + pytestCheckHook + pytest-xdist + pytz + requests + ]; + + disabledTests = [ + "test_convert_deps_to_pip" + "test_download_file" + ]; + + disabledTestPaths = [ + "tests/integration" + ]; + postInstall = '' installShellCompletion --cmd pipenv \ --bash <(_PIPENV_COMPLETE=bash_source $out/bin/pipenv) \ @@ -53,13 +81,6 @@ in buildPythonApplication rec { --fish <(_PIPENV_COMPLETE=fish_source $out/bin/pipenv) ''; - doCheck = true; - checkPhase = '' - export HOME=$(mktemp -d) - cp -r --no-preserve=mode ${wheel.src} $HOME/wheel-src - $out/bin/pipenv install $HOME/wheel-src - ''; - meta = with lib; { description = "Python Development Workflow for Humans"; license = licenses.mit;