diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-02-01 16:48:46 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-02-02 12:59:01 +0100 |
commit | ae008ed80b870688e4e0fe5ff305dc40c17458b4 (patch) | |
tree | e5d9fcd24a403f7491d0d6e42364bf91fdb2ac6e /test/pathod/test_pathoc.py | |
parent | ec92d7f67e3c5960d9b30e067fb4ed1ae3fc8884 (diff) | |
download | mitmproxy-ae008ed80b870688e4e0fe5ff305dc40c17458b4.tar.gz mitmproxy-ae008ed80b870688e4e0fe5ff305dc40c17458b4.tar.bz2 mitmproxy-ae008ed80b870688e4e0fe5ff305dc40c17458b4.zip |
replace tutils.raises with pytest.raises + shim
Diffstat (limited to 'test/pathod/test_pathoc.py')
-rw-r--r-- | test/pathod/test_pathoc.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/pathod/test_pathoc.py b/test/pathod/test_pathoc.py index 23e0f973..a8f79e67 100644 --- a/test/pathod/test_pathoc.py +++ b/test/pathod/test_pathoc.py @@ -78,7 +78,8 @@ class TestDaemonSSL(PathocTestDaemon): ssl=False, fp=fp ) - tutils.raises(NotImplementedError, c.connect) + with pytest.raises(NotImplementedError): + c.connect() class TestDaemon(PathocTestDaemon): @@ -172,12 +173,12 @@ class TestDaemon(PathocTestDaemon): to = ("foobar", 80) c = pathoc.Pathoc(("127.0.0.1", self.d.port), fp=None) c.rfile, c.wfile = io.BytesIO(), io.BytesIO() - with tutils.raises("connect failed"): + with pytest.raises("connect failed"): c.http_connect(to) c.rfile = io.BytesIO( b"HTTP/1.1 500 OK\r\n" ) - with tutils.raises("connect failed"): + with pytest.raises("connect failed"): c.http_connect(to) c.rfile = io.BytesIO( b"HTTP/1.1 200 OK\r\n" @@ -188,18 +189,21 @@ class TestDaemon(PathocTestDaemon): to = ("foobar", 80) c = pathoc.Pathoc(("127.0.0.1", self.d.port), fp=None) c.rfile, c.wfile = tutils.treader(b""), io.BytesIO() - tutils.raises(pathoc.PathocError, c.socks_connect, to) + with pytest.raises(pathoc.PathocError): + c.socks_connect(to) c.rfile = tutils.treader( b"\x05\xEE" ) - tutils.raises("SOCKS without authentication", c.socks_connect, ("example.com", 0xDEAD)) + with pytest.raises("SOCKS without authentication"): + c.socks_connect(("example.com", 0xDEAD)) c.rfile = tutils.treader( b"\x05\x00" + b"\x05\xEE\x00\x03\x0bexample.com\xDE\xAD" ) - tutils.raises("SOCKS server error", c.socks_connect, ("example.com", 0xDEAD)) + with pytest.raises("SOCKS server error"): + c.socks_connect(("example.com", 0xDEAD)) c.rfile = tutils.treader( b"\x05\x00" + |