python3Packages.cheroot: fix tests, cleanup expr

This commit is contained in:
Jonathan Ringer 2020-06-22 15:43:09 -07:00 committed by Jon
parent 67e8240371
commit 3853e60ae3

View File

@ -1,10 +1,19 @@
{ stdenv, fetchPypi, buildPythonPackage, pythonAtLeast, isPy3k
, more-itertools, six, setuptools_scm, setuptools-scm-git-archive
, pytest, pytestcov, portend, pytest-testmon, pytest-mock
, backports_unittest-mock, pyopenssl, requests, trustme, requests-unixsocket
, backports_functools_lru_cache }:
let inherit (stdenv) lib; in
{ lib, stdenv, fetchPypi, buildPythonPackage, isPy3k
, jaraco_text
, more-itertools
, portend
, pyopenssl
, pytestCheckHook
, pytestcov
, pytest-mock
, pytest-testmon
, requests
, requests-unixsocket
, setuptools_scm
, setuptools-scm-git-archive
, six
, trustme
}:
buildPythonPackage rec {
pname = "cheroot";
@ -19,21 +28,39 @@ buildPythonPackage rec {
nativeBuildInputs = [ setuptools_scm setuptools-scm-git-archive ];
propagatedBuildInputs = [ more-itertools six backports_functools_lru_cache ];
propagatedBuildInputs = [ more-itertools six ];
checkInputs = [ pytest pytestcov portend backports_unittest-mock pytest-mock pytest-testmon pyopenssl requests trustme requests-unixsocket ];
checkInputs = [
jaraco_text
portend
pyopenssl
pytestCheckHook
pytestcov
pytest-mock
pytest-testmon
requests
requests-unixsocket
trustme
];
# Disable doctest plugin because times out
# Disable xdist (-n arg) because it's incompatible with testmon
# Deselect test_bind_addr_unix on darwin because times out
# Deselect test_http_over_https_error on darwin because builtin cert fails
# Disable warnings-as-errors because of deprecation warnings from socks on python 3.7
checkPhase = ''
substituteInPlace pytest.ini --replace "--doctest-modules" "" --replace "-n auto" ""
${lib.optionalString (pythonAtLeast "3.7") "sed -i '/warnings/,+2d' pytest.ini"}
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"}
# adds many other pytest utilities which aren't necessary like linting
preCheck = ''
rm pytest.ini
'';
disabledTests= [
"tls" # touches network
"peercreds_unix_sock" # test urls no longer allowed
] ++ lib.optionals stdenv.isDarwin [
"http_over_https_error"
"bind_addr_unix"
];
# Some of the tests use localhost networking.
__darwinAllowLocalNetworking = true;