diff options
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" + |