python3Packages.clikit: relax crashtest constraint, enable tests

This commit is contained in:
Martin Weinelt 2022-09-16 01:39:11 +02:00
parent 72b0549074
commit e118a8d81f

View File

@ -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";