From 64785239135c12290fae549cfe756ed7cede67e0 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sun, 13 May 2018 09:56:30 +0200 Subject: [PATCH 1/2] test on Python 3.7-dev --- .travis.yml | 2 ++ tox.ini | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3e8b48828..c601955d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ matrix: env: TOXENV=py36 BDIST=1 WHEEL=1 - python: 3.6 env: TOXENV=individual_coverage + - python: "3.7-dev" + env: TOXENV=py37 - language: node_js node_js: "node" before_install: diff --git a/tox.ini b/tox.ini index 475f19513..a9054e5b2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36, lint +envlist = py36, py37, lint skipsdist = True toxworkdir={env:TOX_WORK_DIR:.tox} From 9979be648750b6983b233ec3a8c3c644d8c332a1 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Mon, 14 May 2018 10:39:00 +0200 Subject: [PATCH 2/2] fix py36/37 escaping issues closes #3122 https://bugs.python.org/issue16285 https://bugs.python.org/issue12910 https://github.com/python/cpython/commit/21024f06622c4c55b666adb130797a4ee205d005 --- test/mitmproxy/net/http/test_url.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/mitmproxy/net/http/test_url.py b/test/mitmproxy/net/http/test_url.py index c9f61fafd..ecf8e8969 100644 --- a/test/mitmproxy/net/http/test_url.py +++ b/test/mitmproxy/net/http/test_url.py @@ -63,17 +63,21 @@ def test_unparse(): assert url.unparse("https", "foo.com", 443, "") == "https://foo.com" -surrogates = bytes(range(256)).decode("utf8", "surrogateescape") +# We ignore the byte 126: '~' because of an incompatibility in Python 3.6 and 3.7 +# In 3.6 it is escaped as %7E +# In 3.7 it stays as ASCII character '~' +# https://bugs.python.org/issue16285 +surrogates = (bytes(range(0, 126)) + bytes(range(127, 256))).decode("utf8", "surrogateescape") surrogates_quoted = ( '%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F' '%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F' '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-./' - '0123456789%3A%3B%3C%3D%3E%3F' - '%40ABCDEFGHIJKLMNO' - 'PQRSTUVWXYZ%5B%5C%5D%5E_' - '%60abcdefghijklmno' - 'pqrstuvwxyz%7B%7C%7D%7E%7F' + '0123456789%3A%3B%3C%3D%3E%3F%40' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + '%5B%5C%5D%5E_%60' + 'abcdefghijklmnopqrstuvwxyz' + '%7B%7C%7D%7F' # 7E or ~ is excluded! '%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F' '%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F' '%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF'