2021-02-05 17:12:51 +00:00
|
|
|
{ lib, buildPythonPackage, fetchPypi
|
2021-06-04 09:07:49 +00:00
|
|
|
, pytest, setuptools-scm, isPy3k }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "apipkg";
|
|
|
|
version = "1.5";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
sha256 = "37228cda29411948b422fae072f57e31d3396d2ee1c9783775980ee9c9990af6";
|
|
|
|
};
|
|
|
|
|
2021-06-04 09:07:49 +00:00
|
|
|
nativeBuildInputs = [ setuptools-scm ];
|
2020-04-24 23:36:52 +00:00
|
|
|
checkInputs = [ pytest ];
|
|
|
|
|
|
|
|
# Fix pytest 4 support. See: https://github.com/pytest-dev/apipkg/issues/14
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace "test_apipkg.py" \
|
|
|
|
--replace "py.test.ensuretemp('test_apipkg')" "py.path.local('test_apipkg')"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Failing tests on Python 3
|
|
|
|
# https://github.com/pytest-dev/apipkg/issues/17
|
|
|
|
checkPhase = let
|
2021-02-05 17:12:51 +00:00
|
|
|
disabledTests = lib.optionals isPy3k [
|
2020-04-24 23:36:52 +00:00
|
|
|
"test_error_loading_one_element"
|
|
|
|
"test_aliasmodule_proxy_methods"
|
|
|
|
"test_eagerload_on_bython"
|
|
|
|
];
|
2021-02-05 17:12:51 +00:00
|
|
|
testExpression = lib.optionalString (disabledTests != [])
|
|
|
|
"-k 'not ${lib.concatStringsSep " and not " disabledTests}'";
|
2020-04-24 23:36:52 +00:00
|
|
|
in ''
|
|
|
|
py.test ${testExpression}
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Namespace control and lazy-import mechanism";
|
|
|
|
homepage = "https://github.com/pytest-dev/apipkg";
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|