1{ lib, buildPythonPackage, fetchPypi
2, pytest, setuptools-scm, isPy3k }:
3
4buildPythonPackage rec {
5 pname = "apipkg";
6 version = "1.5";
7
8 src = fetchPypi {
9 inherit pname version;
10 sha256 = "37228cda29411948b422fae072f57e31d3396d2ee1c9783775980ee9c9990af6";
11 };
12
13 nativeBuildInputs = [ setuptools-scm ];
14 checkInputs = [ pytest ];
15
16 # Fix pytest 4 support. See: https://github.com/pytest-dev/apipkg/issues/14
17 postPatch = ''
18 substituteInPlace "test_apipkg.py" \
19 --replace "py.test.ensuretemp('test_apipkg')" "py.path.local('test_apipkg')"
20 '';
21
22 # Failing tests on Python 3
23 # https://github.com/pytest-dev/apipkg/issues/17
24 checkPhase = let
25 disabledTests = lib.optionals isPy3k [
26 "test_error_loading_one_element"
27 "test_aliasmodule_proxy_methods"
28 "test_eagerload_on_bython"
29 ];
30 testExpression = lib.optionalString (disabledTests != [])
31 "-k 'not ${lib.concatStringsSep " and not " disabledTests}'";
32 in ''
33 py.test ${testExpression}
34 '';
35
36 meta = with lib; {
37 description = "Namespace control and lazy-import mechanism";
38 homepage = "https://github.com/pytest-dev/apipkg";
39 license = licenses.mit;
40 };
41}