about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-09-15 19:23:30 +0200
committerGitHub <noreply@github.com>2019-09-15 19:23:30 +0200
commite6b249ce21fad9fd8eb0a74cadf82964924e9467 (patch)
tree01e9c7d5d74ac11749774646f277663260e715d1 /pkgs/tools
parent5abd97aa9227c42b677c0f9436518275970db97a (diff)
parent5d0c384fc12a73bbde1a7c49eb152d0ae3702964 (diff)
downloadnixlib-e6b249ce21fad9fd8eb0a74cadf82964924e9467.tar
nixlib-e6b249ce21fad9fd8eb0a74cadf82964924e9467.tar.gz
nixlib-e6b249ce21fad9fd8eb0a74cadf82964924e9467.tar.bz2
nixlib-e6b249ce21fad9fd8eb0a74cadf82964924e9467.tar.lz
nixlib-e6b249ce21fad9fd8eb0a74cadf82964924e9467.tar.xz
nixlib-e6b249ce21fad9fd8eb0a74cadf82964924e9467.tar.zst
nixlib-e6b249ce21fad9fd8eb0a74cadf82964924e9467.zip
Merge pull request #68685 from B4dM4n/mitmproxy-pytest5
mitmproxy: add pytest5 compatability
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/networking/mitmproxy/default.nix5
-rw-r--r--pkgs/tools/networking/mitmproxy/pytest5.patch31
2 files changed, 34 insertions, 2 deletions
diff --git a/pkgs/tools/networking/mitmproxy/default.nix b/pkgs/tools/networking/mitmproxy/default.nix
index ee331648e75f..a9758e5fd471 100644
--- a/pkgs/tools/networking/mitmproxy/default.nix
+++ b/pkgs/tools/networking/mitmproxy/default.nix
@@ -42,6 +42,7 @@ buildPythonPackage rec {
       # Irrelevant in nixpkgs
       excludes = [ "setup.py" "setup.cfg" "release/docker/*" ];
     })
+    ./pytest5.patch
   ];
 
   postPatch = ''
@@ -54,7 +55,7 @@ buildPythonPackage rec {
   checkPhase = ''
     export HOME=$(mktemp -d)
     export LC_CTYPE=en_US.UTF-8
-    pytest -k 'not test_find_unclaimed_URLs'
+    pytest -k 'not test_find_unclaimed_URLs and not test_tcp'
   '';
 
   propagatedBuildInputs = [
@@ -62,7 +63,7 @@ buildPythonPackage rec {
     h2 hyperframe kaitaistruct passlib
     pyasn1 pyopenssl pyparsing pyperclip
     ruamel_yaml tornado urwid brotlipy
-    sortedcontainers ldap3 wsproto
+    sortedcontainers ldap3 wsproto setuptools
   ];
 
   checkInputs = [
diff --git a/pkgs/tools/networking/mitmproxy/pytest5.patch b/pkgs/tools/networking/mitmproxy/pytest5.patch
new file mode 100644
index 000000000000..bfbf7253b9c4
--- /dev/null
+++ b/pkgs/tools/networking/mitmproxy/pytest5.patch
@@ -0,0 +1,31 @@
+diff --git a/test/mitmproxy/net/test_tls.py b/test/mitmproxy/net/test_tls.py
+index 489bf89f..c78472e3 100644
+--- a/test/mitmproxy/net/test_tls.py
++++ b/test/mitmproxy/net/test_tls.py
+@@ -87,14 +87,16 @@ def test_get_client_hello():
+     rfile = io.BufferedReader(io.BytesIO(
+         FULL_CLIENT_HELLO_NO_EXTENSIONS[:30]
+     ))
+-    with pytest.raises(exceptions.TlsProtocolException, message="Unexpected EOF"):
++    with pytest.raises(exceptions.TlsProtocolException):
+         tls.get_client_hello(rfile)
++        pytest.fail("Unexpected EOF")
+ 
+     rfile = io.BufferedReader(io.BytesIO(
+         b"GET /"
+     ))
+-    with pytest.raises(exceptions.TlsProtocolException, message="Expected TLS record"):
++    with pytest.raises(exceptions.TlsProtocolException):
+         tls.get_client_hello(rfile)
++        pytest.fail("Expected TLS record")
+ 
+ 
+ class TestClientHello:
+@@ -153,5 +155,6 @@ class TestClientHello:
+             b"\x01\x00\x00\x03" +  # handshake header
+             b"foo"
+         ))
+-        with pytest.raises(exceptions.TlsProtocolException, message='Cannot parse Client Hello'):
++        with pytest.raises(exceptions.TlsProtocolException):
+             tls.ClientHello.from_file(rfile)
++            pytest.fail('Cannot parse Client Hello')