diff --git a/mitmproxy/eventsequence.py b/mitmproxy/eventsequence.py index 905cb7bc2..5872f607e 100644 --- a/mitmproxy/eventsequence.py +++ b/mitmproxy/eventsequence.py @@ -70,4 +70,4 @@ def iterate(f): yield "tcp_error", f yield "tcp_end", f else: - raise ValueError + raise TypeError() diff --git a/mitmproxy/version.py b/mitmproxy/version.py index a5faf5115..22382c940 100644 --- a/mitmproxy/version.py +++ b/mitmproxy/version.py @@ -3,5 +3,5 @@ VERSION = ".".join(str(i) for i in IVERSION) PATHOD = "pathod " + VERSION MITMPROXY = "mitmproxy " + VERSION -if __name__ == "__main__": # pragma: no cover +if __name__ == "__main__": print(VERSION) diff --git a/test/mitmproxy/test_eventsequence.py b/test/mitmproxy/test_eventsequence.py index 6e2542256..fe0f92b32 100644 --- a/test/mitmproxy/test_eventsequence.py +++ b/test/mitmproxy/test_eventsequence.py @@ -53,5 +53,5 @@ def test_tcp_flow(err): def test_invalid(): - with pytest.raises(ValueError): + with pytest.raises(TypeError): next(eventsequence.iterate(42)) diff --git a/test/mitmproxy/test_version.py b/test/mitmproxy/test_version.py new file mode 100644 index 000000000..f87b08517 --- /dev/null +++ b/test/mitmproxy/test_version.py @@ -0,0 +1,10 @@ +import runpy + +from mitmproxy import version + + +def test_version(capsys): + runpy.run_module('mitmproxy.version', run_name='__main__') + stdout, stderr = capsys.readouterr() + assert len(stdout) > 0 + assert stdout.strip() == version.VERSION