Unverified Commit 0ceee835 authored by Theodore Ni's avatar Theodore Ni
Browse files

pipenv: remove wheel install test, enable unit tests

parent ce3d6fe5
Loading
Loading
Loading
Loading
+34 −13
Original line number Diff line number Diff line
{ 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;