Merge pull request #68685 from B4dM4n/mitmproxy-pytest5
mitmproxy: add pytest5 compatability
This commit is contained in:
commit
e6b249ce21
2 changed files with 34 additions and 2 deletions
|
@ -42,6 +42,7 @@ buildPythonPackage rec {
|
||||||
# Irrelevant in nixpkgs
|
# Irrelevant in nixpkgs
|
||||||
excludes = [ "setup.py" "setup.cfg" "release/docker/*" ];
|
excludes = [ "setup.py" "setup.cfg" "release/docker/*" ];
|
||||||
})
|
})
|
||||||
|
./pytest5.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
@ -54,7 +55,7 @@ buildPythonPackage rec {
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
export HOME=$(mktemp -d)
|
export HOME=$(mktemp -d)
|
||||||
export LC_CTYPE=en_US.UTF-8
|
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 = [
|
propagatedBuildInputs = [
|
||||||
|
@ -62,7 +63,7 @@ buildPythonPackage rec {
|
||||||
h2 hyperframe kaitaistruct passlib
|
h2 hyperframe kaitaistruct passlib
|
||||||
pyasn1 pyopenssl pyparsing pyperclip
|
pyasn1 pyopenssl pyparsing pyperclip
|
||||||
ruamel_yaml tornado urwid brotlipy
|
ruamel_yaml tornado urwid brotlipy
|
||||||
sortedcontainers ldap3 wsproto
|
sortedcontainers ldap3 wsproto setuptools
|
||||||
];
|
];
|
||||||
|
|
||||||
checkInputs = [
|
checkInputs = [
|
||||||
|
|
31
pkgs/tools/networking/mitmproxy/pytest5.patch
Normal file
31
pkgs/tools/networking/mitmproxy/pytest5.patch
Normal file
|
@ -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')
|
Loading…
Reference in a new issue