git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #68685 from B4dM4n/mitmproxy-pytest5

mitmproxy: add pytest5 compatability

commite6b249ce21fad9fd8eb0a74cadf82964924e9467 authorMaximilian Bosch <maximilian@mbosch.me> dateSun 15 Sep 2019, 19:23 (7 years ago) parent5abd97a5d0c384
2 files changed+34−2
pkgs/tools/networking/mitmproxy/default.nix+3−2 pkgs/tools/networking/mitmproxy/pytest5.patch+31
pkgs/tools/networking/mitmproxy/default.nix+3−2
@@ -42,6 +42,7 @@ buildPythonPackage rec {
4242 # Irrelevant in nixpkgs
4343 excludes = [ "setup.py" "setup.cfg" "release/docker/*" ];
4444 })
45+ ./pytest5.patch
4546 ];
4647
4748 postPatch = ''
@@ -54,7 +55,7 @@ buildPythonPackage rec {
5455 checkPhase = ''
5556 export HOME=$(mktemp -d)
5657 export LC_CTYPE=en_US.UTF-8
57− pytest -k 'not test_find_unclaimed_URLs'
58+ pytest -k 'not test_find_unclaimed_URLs and not test_tcp'
5859 '';
5960
6061 propagatedBuildInputs = [
@@ -62,7 +63,7 @@ buildPythonPackage rec {
6263 h2 hyperframe kaitaistruct passlib
6364 pyasn1 pyopenssl pyparsing pyperclip
6465 ruamel_yaml tornado urwid brotlipy
65− sortedcontainers ldap3 wsproto
66+ sortedcontainers ldap3 wsproto setuptools
6667 ];
6768
6869 checkInputs = [
pkgs/tools/networking/mitmproxy/pytest5.patchnew file+31
@@ -0,0 +1,31 @@
1+diff --git a/test/mitmproxy/net/test_tls.py b/test/mitmproxy/net/test_tls.py
2+index 489bf89f..c78472e3 100644
3+--- a/test/mitmproxy/net/test_tls.py
4++++ b/test/mitmproxy/net/test_tls.py
5+@@ -87,14 +87,16 @@ def test_get_client_hello():
6+ rfile = io.BufferedReader(io.BytesIO(
7+ FULL_CLIENT_HELLO_NO_EXTENSIONS[:30]
8+ ))
9+- with pytest.raises(exceptions.TlsProtocolException, message="Unexpected EOF"):
10++ with pytest.raises(exceptions.TlsProtocolException):
11+ tls.get_client_hello(rfile)
12++ pytest.fail("Unexpected EOF")
13+
14+ rfile = io.BufferedReader(io.BytesIO(
15+ b"GET /"
16+ ))
17+- with pytest.raises(exceptions.TlsProtocolException, message="Expected TLS record"):
18++ with pytest.raises(exceptions.TlsProtocolException):
19+ tls.get_client_hello(rfile)
20++ pytest.fail("Expected TLS record")
21+
22+
23+ class TestClientHello:
24+@@ -153,5 +155,6 @@ class TestClientHello:
25+ b"\x01\x00\x00\x03" + # handshake header
26+ b"foo"
27+ ))
28+- with pytest.raises(exceptions.TlsProtocolException, message='Cannot parse Client Hello'):
29++ with pytest.raises(exceptions.TlsProtocolException):
30+ tls.ClientHello.from_file(rfile)
31++ pytest.fail('Cannot parse Client Hello')