From e118a8d81f72dc6712640a127b530ac053a01b26 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 16 Sep 2022 01:39:11 +0200 Subject: [PATCH] python3Packages.clikit: relax crashtest constraint, enable tests --- .../python-modules/clikit/default.nix | 67 ++++++++++++++----- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/clikit/default.nix b/pkgs/development/python-modules/clikit/default.nix index 1f6be754be19..af366cdbec06 100644 --- a/pkgs/development/python-modules/clikit/default.nix +++ b/pkgs/development/python-modules/clikit/default.nix @@ -1,26 +1,63 @@ -{ lib, buildPythonPackage, fetchPypi -, isPy27, pythonAtLeast -, pylev, pastel, typing ? null, enum34 ? null, crashtest }: +{ lib +, buildPythonPackage +, fetchFromGitHub +, isPy27 +, pythonAtLeast +, poetry-core + +# propagates +, pylev +, pastel + +# python36+ +, crashtest + +# python2 +, typing +, enum34 + +# tests +, pytest-mock +, pytestCheckHook +}: buildPythonPackage rec { pname = "clikit"; version = "0.6.2"; + format = "pyproject"; - src = fetchPypi { - inherit pname version; - sha256 = "0ngdkmb73gkp5y00q7r9k1cdlfn0wyzws2wrqlshc4hlkbdyabj4"; + src = fetchFromGitHub { + owner = "sdispater"; + repo = pname; + rev = "refs/tags/${version}"; + hash = "sha256-xAsUNhVQBjtSFHyjjnicAKRC3+Tdn3AdGDUYhmOOIdA="; }; - propagatedBuildInputs = [ - pylev pastel - ] - ++ lib.optionals (pythonAtLeast "3.6") [ crashtest ] - ++ lib.optionals isPy27 [ typing enum34 ]; + postPatch = '' + substituteInPlace pyproject.toml --replace \ + 'crashtest = { version = "^0.3.0", python = "^3.6" }' \ + 'crashtest = { version = "*", python = "^3.6" }' + ''; - # The Pypi tarball doesn't include tests, and the GitHub source isn't - # buildable until we bootstrap poetry, see - # https://github.com/NixOS/nixpkgs/pull/53599#discussion_r245855665 - doCheck = false; + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + pylev + pastel + ] + ++ lib.optionals (pythonAtLeast "3.6") [ crashtest ] + ++ lib.optionals isPy27 [ typing enum34 ]; + + checkInputs = [ + pytest-mock + pytestCheckHook + ]; + + pythonImportsCheck = [ + "clikit" + ]; meta = with lib; { homepage = "https://github.com/sdispater/clikit";