aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-12-27 19:09:43 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-12-27 19:09:56 +0100
commitc78ffbf16dd8684261652d2de91d8950eea037e9 (patch)
treea1814523d2f599221951ef3e99b69692d56160a8 /test
parent51d57cfd4ac5bdce90eb5ecfc5b82c827a7b405e (diff)
downloadmitmproxy-c78ffbf16dd8684261652d2de91d8950eea037e9.tar.gz
mitmproxy-c78ffbf16dd8684261652d2de91d8950eea037e9.tar.bz2
mitmproxy-c78ffbf16dd8684261652d2de91d8950eea037e9.zip
fix url.parse tests for Python 3.6
This is a simpler version of @Kriechi's patch.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/net/http/test_url.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/mitmproxy/net/http/test_url.py b/test/mitmproxy/net/http/test_url.py
index 94b2eacc..5f85112b 100644
--- a/test/mitmproxy/net/http/test_url.py
+++ b/test/mitmproxy/net/http/test_url.py
@@ -1,3 +1,6 @@
+import pytest
+import sys
+
from mitmproxy.test import tutils
from mitmproxy.net.http import url
@@ -42,14 +45,18 @@ def test_parse():
# Null byte in host
with tutils.raises(ValueError):
url.parse("http://foo\0")
- # Port out of range
- _, _, port, _ = url.parse("http://foo:999999")
- assert port == 80
# Invalid IPv6 URL - see http://www.ietf.org/rfc/rfc2732.txt
with tutils.raises(ValueError):
url.parse('http://lo[calhost')
+@pytest.mark.skipif(sys.version_info < (3, 6), reason='requires Python 3.6 or higher')
+def test_parse_port_range():
+ # Port out of range
+ with tutils.raises(ValueError):
+ url.parse("http://foo:999999")
+
+
def test_unparse():
assert url.unparse("http", "foo.com", 99, "") == "http://foo.com:99"
assert url.unparse("http", "foo.com", 80, "/bar") == "http://foo.com/bar"