1{ stdenv, fetchPypi, buildPythonPackage, pythonAtLeast
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 = "6.5.6";
12
13 src = fetchPypi {
14 inherit pname version;
15 sha256 = "b824f9961eb447809badeb051820a05770354e2f9ae5c355eecc21f22633c217";
16 };
17
18 patches = [ ./tests.patch ];
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}