Merge pull request #68685 from B4dM4n/mitmproxy-pytest5

mitmproxy: add pytest5 compatability
This commit is contained in:
Maximilian Bosch 2019-09-15 19:23:30 +02:00 committed by GitHub
commit e6b249ce21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 2 deletions

View file

@ -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 = [

View 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')