Bug 1496507 [wpt PR 13355] - Python 3: Don't decode ReplacementTokenizer results., a=testonly
authorMs2ger <Ms2ger@gmail.com>
Thu, 11 Oct 2018 09:30:52 +0000
changeset 496755 a521fa7d812ee7738ab48107cc91c09b0d772bba
parent 496754 778947aa35feb8fd5ae1e8d192d98e1bec585bd3
child 496756 3756ef7dd9972afdcf6e5dff4f476e933b92dea1
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1496507, 13355
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1496507 [wpt PR 13355] - Python 3: Don't decode ReplacementTokenizer results., a=testonly Automatic update from web-platform-testsPython 3: Don't decode ReplacementTokenizer results. ReplacementTokenizer was changed to always return text in a4b7841ea1345ffdcbd79e399f7ff1982fab5362, while this decode() call was added around the same time in 27406c9d238ac80c43bb62e87cd0305f59294527. This changes the code to verify that the type of the field local is as expected. -- wpt-commits: 9efb40976533474bbdc068944b704cb282c55339 wpt-pr: 13355
testing/web-platform/tests/tools/wptserve/tests/functional/test_handlers.py
testing/web-platform/tests/tools/wptserve/wptserve/pipes.py
--- a/testing/web-platform/tests/tools/wptserve/tests/functional/test_handlers.py
+++ b/testing/web-platform/tests/tools/wptserve/tests/functional/test_handlers.py
@@ -83,29 +83,26 @@ class TestFileHandler(TestUsingServer):
             self.request("/document.txt", headers={"Range":"bytes=11-10"})
         self.assertEqual(cm.exception.code, 416)
 
         expected = open(os.path.join(doc_root, "document.txt"), 'rb').read()
         with self.assertRaises(HTTPError) as cm:
             self.request("/document.txt", headers={"Range":"bytes=%i-%i" % (len(expected), len(expected) + 10)})
         self.assertEqual(cm.exception.code, 416)
 
-    @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2")
     def test_sub_config(self):
         resp = self.request("/sub.sub.txt")
         expected = b"localhost localhost %i" % self.server.port
         assert resp.read().rstrip() == expected
 
-    @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2")
     def test_sub_headers(self):
         resp = self.request("/sub_headers.sub.txt", headers={"X-Test": "PASS"})
         expected = b"PASS"
         assert resp.read().rstrip() == expected
 
-    @pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2")
     def test_sub_params(self):
         resp = self.request("/sub_params.sub.txt", query="test=PASS")
         expected = b"PASS"
         assert resp.read().rstrip() == expected
 
 
 class TestFunctionHandler(TestUsingServer):
     def test_string_rv(self):
--- a/testing/web-platform/tests/tools/wptserve/wptserve/pipes.py
+++ b/testing/web-platform/tests/tools/wptserve/wptserve/pipes.py
@@ -421,21 +421,22 @@ def template(request, content, escape_ty
 
     def config_replacement(match):
         content, = match.groups()
 
         tokens = tokenizer.tokenize(content)
         tokens = deque(tokens)
 
         token_type, field = tokens.popleft()
-        field = field.decode("ascii")
+        assert isinstance(field, text_type)
 
         if token_type == "var":
             variable = field
             token_type, field = tokens.popleft()
+            assert isinstance(field, text_type)
         else:
             variable = None
 
         if token_type != "ident":
             raise Exception("unexpected token type %s (token '%r'), expected ident" % (token_type, field))
 
         if field in variables:
             value = variables[field]