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