diff options
-rw-r--r-- | mitmproxy/test/tflow.py | 11 | ||||
-rw-r--r-- | test/conftest.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_view.py | 8 |
3 files changed, 11 insertions, 10 deletions
diff --git a/mitmproxy/test/tflow.py b/mitmproxy/test/tflow.py index 5749bd52..a5670538 100644 --- a/mitmproxy/test/tflow.py +++ b/mitmproxy/test/tflow.py @@ -115,13 +115,14 @@ def tflow(client_conn=True, server_conn=True, req=True, resp=None, err=None): return f -def tdummyflow(client_conn=True, server_conn=True, err=None): - class DummyFlow(flow.Flow): - """A flow that is neither HTTP nor TCP.""" +class DummyFlow(flow.Flow): + """A flow that is neither HTTP nor TCP.""" + + def __init__(self, client_conn, server_conn, live=None): + super().__init__("dummy", client_conn, server_conn, live) - def __init__(self, client_conn, server_conn, live=None): - super().__init__("dummy", client_conn, server_conn, live) +def tdummyflow(client_conn=True, server_conn=True, err=None): if client_conn is True: client_conn = tclient_conn() if server_conn is True: diff --git a/test/conftest.py b/test/conftest.py index c44aa461..4b05624b 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -29,8 +29,8 @@ skip_appveyor = pytest.mark.skipif( original_pytest_raises = pytest.raises +@functools.wraps(original_pytest_raises) def raises(exc, *args, **kwargs): - functools.wraps(original_pytest_raises) if isinstance(exc, str): return RaisesContext(exc) else: diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index 60736af7..99b12cb4 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -172,9 +172,9 @@ def test_reversed(): assert v[-1].request.timestamp_start == 1 assert v[2].request.timestamp_start == 1 with pytest.raises(IndexError): - v.__getitem__(5) + v[5] with pytest.raises(IndexError): - v.__getitem__(-5) + v[-5] assert v._bisect(v[0]) == 1 assert v._bisect(v[2]) == 3 @@ -368,14 +368,14 @@ def test_settings(): f = tft() with pytest.raises(KeyError): - v.settings.__getitem__(f) + v.settings[f] v.add(f) v.settings[f]["foo"] = "bar" assert v.settings[f]["foo"] == "bar" assert len(list(v.settings)) == 1 v.remove(f) with pytest.raises(KeyError): - v.settings.__getitem__(f) + v.settings[f] assert not v.settings.keys() v.add(f) |