mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
cheroot: 6.5.5 -> 6.5.6, fix tests with openssl 1.1
This commit is contained in:
parent
9eec5a385b
commit
2596a81743
@ -1,18 +1,22 @@
|
||||
{ stdenv, fetchPypi, buildPythonPackage
|
||||
{ stdenv, fetchPypi, buildPythonPackage, pythonAtLeast
|
||||
, 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
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "cheroot";
|
||||
version = "6.5.5";
|
||||
version = "6.5.6";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "f6a85e005adb5bc5f3a92b998ff0e48795d4d98a0fbb7edde47a7513d4100601";
|
||||
sha256 = "b824f9961eb447809badeb051820a05770354e2f9ae5c355eecc21f22633c217";
|
||||
};
|
||||
|
||||
patches = [ ./tests.patch ];
|
||||
|
||||
nativeBuildInputs = [ setuptools_scm setuptools-scm-git-archive ];
|
||||
|
||||
propagatedBuildInputs = [ more-itertools six backports_functools_lru_cache ];
|
||||
@ -20,14 +24,17 @@ buildPythonPackage rec {
|
||||
checkInputs = [ pytest pytestcov portend backports_unittest-mock pytest-mock pytest-testmon pyopenssl requests trustme requests-unixsocket ];
|
||||
|
||||
# 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" ""
|
||||
pytest ${stdenv.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"}
|
||||
substituteInPlace pytest.ini --replace "--doctest-modules" "" --replace "-n auto" ""
|
||||
${lib.optionalString (pythonAtLeast "3.7") "sed -i '/warnings/,+2d' pytest.ini"}
|
||||
pytest ${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"}
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "High-performance, pure-Python HTTP";
|
||||
homepage = https://github.com/cherrypy/cheroot;
|
||||
license = licenses.mit;
|
||||
|
45
pkgs/development/python-modules/cheroot/tests.patch
Normal file
45
pkgs/development/python-modules/cheroot/tests.patch
Normal file
@ -0,0 +1,45 @@
|
||||
diff --git a/cheroot/test/test_ssl.py b/cheroot/test/test_ssl.py
|
||||
index fe8a0a0..92a77c1 100644
|
||||
--- a/cheroot/test/test_ssl.py
|
||||
+++ b/cheroot/test/test_ssl.py
|
||||
@@ -316,11 +316,9 @@ def test_tls_client_auth(
|
||||
expected_ssl_errors = (
|
||||
requests.exceptions.SSLError,
|
||||
OpenSSL.SSL.Error,
|
||||
- ) if PY34 else (
|
||||
- requests.exceptions.SSLError,
|
||||
+ requests.exceptions.ConnectionError,
|
||||
)
|
||||
- if IS_WINDOWS:
|
||||
- expected_ssl_errors += requests.exceptions.ConnectionError,
|
||||
+
|
||||
with pytest.raises(expected_ssl_errors) as ssl_err:
|
||||
make_https_request()
|
||||
|
||||
@@ -335,7 +333,7 @@ def test_tls_client_auth(
|
||||
except AttributeError:
|
||||
if PY34:
|
||||
pytest.xfail('OpenSSL behaves wierdly under Python 3.4')
|
||||
- elif six.PY3 and IS_WINDOWS:
|
||||
+ elif six.PY3:
|
||||
err_text = str(ssl_err.value)
|
||||
else:
|
||||
raise
|
||||
@@ -348,8 +346,7 @@ def test_tls_client_auth(
|
||||
if IS_MACOS and IS_PYPY and adapter_type == 'pyopenssl':
|
||||
expected_substrings = ('tlsv1 alert unknown ca', )
|
||||
if (
|
||||
- IS_WINDOWS
|
||||
- and tls_verify_mode in (
|
||||
+ tls_verify_mode in (
|
||||
ssl.CERT_REQUIRED,
|
||||
ssl.CERT_OPTIONAL,
|
||||
)
|
||||
@@ -361,6 +358,7 @@ def test_tls_client_auth(
|
||||
"SysCallError(10054, 'WSAECONNRESET')",
|
||||
"('Connection aborted.', "
|
||||
'OSError("(10054, \'WSAECONNRESET\')"))',
|
||||
+ 'OSError("(104, \'ECONNRESET\')"))',
|
||||
)
|
||||
assert any(e in err_text for e in expected_substrings)
|
||||
|
Loading…
Reference in New Issue
Block a user