Patchwork D3495: tests: migrate test-wsgirequest.py to Python 3

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 6:29 p.m.
Message ID <a8a409c8281a7f9a1f65d640b4887a44@localhost.localdomain>
Download mbox | patch
Permalink /patch/31400/
State Not Applicable
Headers show

Comments

phabricator - May 8, 2018, 6:29 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe0598133ac68: tests: migrate test-wsgirequest.py to Python 3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3495?vs=8547&id=8568

REVISION DETAIL
  https://phab.mercurial-scm.org/D3495

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-wsgirequest.py

CHANGE DETAILS




To: durin42, pulkit, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/tests/test-wsgirequest.py b/tests/test-wsgirequest.py
--- a/tests/test-wsgirequest.py
+++ b/tests/test-wsgirequest.py
@@ -206,18 +206,18 @@ 
         """repository path components get stripped from URL."""
 
         with self.assertRaisesRegex(error.ProgrammingError,
-                                     b'reponame requires PATH_INFO'):
+                                    'reponame requires PATH_INFO'):
             parse(DEFAULT_ENV, reponame=b'repo')
 
         with self.assertRaisesRegex(error.ProgrammingError,
-                                     b'PATH_INFO does not begin with repo '
-                                     b'name'):
+                                    'PATH_INFO does not begin with repo '
+                                    'name'):
             parse(DEFAULT_ENV, reponame=b'repo', extra={
                 r'PATH_INFO': r'/pathinfo',
             })
 
         with self.assertRaisesRegex(error.ProgrammingError,
-                                     b'reponame prefix of PATH_INFO'):
+                                    'reponame prefix of PATH_INFO'):
             parse(DEFAULT_ENV, reponame=b'repo', extra={
                 r'PATH_INFO': r'/repoextra/path',
             })
@@ -251,7 +251,7 @@ 
 
     def testaltbaseurl(self):
         # Simple hostname remap.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver')
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver')
 
         self.assertEqual(r.url, b'http://testserver')
         self.assertEqual(r.baseurl, b'http://testserver')
@@ -264,7 +264,7 @@ 
         self.assertIsNone(r.reponame)
 
         # With a custom port.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver:8000')
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver:8000')
         self.assertEqual(r.url, b'http://testserver')
         self.assertEqual(r.baseurl, b'http://testserver')
         self.assertEqual(r.advertisedurl, b'http://altserver:8000')
@@ -276,7 +276,7 @@ 
         self.assertIsNone(r.reponame)
 
         # With a changed protocol.
-        r = parse(DEFAULT_ENV, altbaseurl='https://altserver')
+        r = parse(DEFAULT_ENV, altbaseurl=b'https://altserver')
         self.assertEqual(r.url, b'http://testserver')
         self.assertEqual(r.baseurl, b'http://testserver')
         self.assertEqual(r.advertisedurl, b'https://altserver')
@@ -289,7 +289,7 @@ 
         self.assertIsNone(r.reponame)
 
         # Need to specify explicit port number for proper https:// alt URLs.
-        r = parse(DEFAULT_ENV, altbaseurl='https://altserver:443')
+        r = parse(DEFAULT_ENV, altbaseurl=b'https://altserver:443')
         self.assertEqual(r.url, b'http://testserver')
         self.assertEqual(r.baseurl, b'http://testserver')
         self.assertEqual(r.advertisedurl, b'https://altserver')
@@ -301,7 +301,7 @@ 
         self.assertIsNone(r.reponame)
 
         # With only PATH_INFO defined.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver', extra={
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver', extra={
             r'PATH_INFO': r'/path1/path2',
         })
         self.assertEqual(r.url, b'http://testserver/path1/path2')
@@ -315,7 +315,7 @@ 
         self.assertIsNone(r.reponame)
 
         # Path on alt URL.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath')
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath')
         self.assertEqual(r.url, b'http://testserver')
         self.assertEqual(r.baseurl, b'http://testserver')
         self.assertEqual(r.advertisedurl, b'http://altserver/altpath')
@@ -327,7 +327,7 @@ 
         self.assertIsNone(r.reponame)
 
         # With a trailing slash.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath/')
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath/')
         self.assertEqual(r.url, b'http://testserver')
         self.assertEqual(r.baseurl, b'http://testserver')
         self.assertEqual(r.advertisedurl, b'http://altserver/altpath/')
@@ -339,7 +339,7 @@ 
         self.assertIsNone(r.reponame)
 
         # PATH_INFO + path on alt URL.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath', extra={
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath', extra={
             r'PATH_INFO': r'/path1/path2',
         })
         self.assertEqual(r.url, b'http://testserver/path1/path2')
@@ -354,7 +354,7 @@ 
         self.assertIsNone(r.reponame)
 
         # PATH_INFO + path on alt URL with trailing slash.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath/', extra={
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath/', extra={
             r'PATH_INFO': r'/path1/path2',
         })
         self.assertEqual(r.url, b'http://testserver/path1/path2')
@@ -369,7 +369,7 @@ 
         self.assertIsNone(r.reponame)
 
         # Local SCRIPT_NAME is ignored.
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver', extra={
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver', extra={
             r'SCRIPT_NAME': r'/script',
             r'PATH_INFO': r'/path1/path2',
         })
@@ -384,7 +384,7 @@ 
         self.assertIsNone(r.reponame)
 
         # Use remote's path for script name, app path
-        r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altroot', extra={
+        r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altroot', extra={
             r'SCRIPT_NAME': r'/script',
             r'PATH_INFO': r'/path1/path2',
         })
@@ -401,7 +401,7 @@ 
 
         # reponame is factored in properly.
         r = parse(DEFAULT_ENV, reponame=b'repo',
-                  altbaseurl='http://altserver/altroot',
+                  altbaseurl=b'http://altserver/altroot',
                   extra={
                 r'SCRIPT_NAME': r'/script',
                 r'PATH_INFO': r'/repo/path1/path2',
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -464,4 +464,5 @@ 
 test-wireproto-clientreactor.py
 test-wireproto-framing.py
 test-wireproto-serverreactor.py
+test-wsgirequest.py
 test-xdg.t