1{ stdenv, fetchPypi, buildPythonPackage, pythonAtLeast, isPy3k
2, more-itertools, six, setuptools_scm, setuptools-scm-git-archive
3, pytest, pytestcov, portend, pytest-testmon, pytest-mock
4, backports_unittest-mock, pyopenssl, requests, trustme, requests-unixsocket
5, backports_functools_lru_cache }:
6
7let inherit (stdenv) lib; in
8
9buildPythonPackage rec {
10 pname = "cheroot";
11 version = "8.2.1";
12
13 disabled = !isPy3k;
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "5b525b3e4a755adf78070ab54c1821fb860d4255a9317dba2b88eb2df2441cff";
18 };
19
20 nativeBuildInputs = [ setuptools_scm setuptools-scm-git-archive ];
21
22 propagatedBuildInputs = [ more-itertools six backports_functools_lru_cache ];
23
24 checkInputs = [ pytest pytestcov portend backports_unittest-mock pytest-mock pytest-testmon pyopenssl requests trustme requests-unixsocket ];
25
26 # Disable doctest plugin because times out
27 # Disable xdist (-n arg) because it's incompatible with testmon
28 # Deselect test_bind_addr_unix on darwin because times out
29 # Deselect test_http_over_https_error on darwin because builtin cert fails
30 # Disable warnings-as-errors because of deprecation warnings from socks on python 3.7
31 checkPhase = ''
32 substituteInPlace pytest.ini --replace "--doctest-modules" "" --replace "-n auto" ""
33 ${lib.optionalString (pythonAtLeast "3.7") "sed -i '/warnings/,+2d' pytest.ini"}
34 pytest -k 'not tls' ${lib.optionalString stdenv.isDarwin "--deselect=cheroot/test/test_ssl.py::test_http_over_https_error --deselect=cheroot/test/test_server.py::test_bind_addr_unix"}
35 '';
36
37 # Some of the tests use localhost networking.
38 __darwinAllowLocalNetworking = true;
39
40 meta = with lib; {
41 description = "High-performance, pure-Python HTTP";
42 homepage = https://github.com/cherrypy/cheroot;
43 license = licenses.mit;
44 };
45}