D3529: tests: use stringutil.pprint instead of custom dumper in test-hgweb-auth.py

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu May 10 14:47:23 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4d29543cc1e0: tests: use stringutil.pprint instead of custom dumper in test-hgweb-auth.py (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3529?vs=8623&id=8634

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

AFFECTED FILES
  tests/test-hgweb-auth.py
  tests/test-hgweb-auth.py.out

CHANGE DETAILS

diff --git a/tests/test-hgweb-auth.py.out b/tests/test-hgweb-auth.py.out
--- a/tests/test-hgweb-auth.py.out
+++ b/tests/test-hgweb-auth.py.out
@@ -1,7 +1,7 @@
 
 *** Test in-uri schemes
 
-CFG: {x.prefix: http://example.org}
+CFG: {b'x.prefix': b'http://example.org'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -18,7 +18,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: https://example.org}
+CFG: {b'x.prefix': b'https://example.org'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -35,7 +35,7 @@
      ('x', 'x')
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: http://example.org, x.schemes: https}
+CFG: {b'x.prefix': b'http://example.org', b'x.schemes': b'https'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -52,7 +52,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: https://example.org, x.schemes: http}
+CFG: {b'x.prefix': b'https://example.org', b'x.schemes': b'http'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -72,7 +72,7 @@
 
 *** Test separately configured schemes
 
-CFG: {x.prefix: example.org, x.schemes: http}
+CFG: {b'x.prefix': b'example.org', b'x.schemes': b'http'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -89,7 +89,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: example.org, x.schemes: https}
+CFG: {b'x.prefix': b'example.org', b'x.schemes': b'https'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -106,7 +106,7 @@
      ('x', 'x')
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: example.org, x.schemes: http https}
+CFG: {b'x.prefix': b'example.org', b'x.schemes': b'http https'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -126,7 +126,7 @@
 
 *** Test prefix matching
 
-CFG: {x.prefix: http://example.org/foo, y.prefix: http://example.org/bar}
+CFG: {b'x.prefix': b'http://example.org/foo', b'y.prefix': b'http://example.org/bar'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -143,7 +143,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: http://example.org/foo, y.prefix: http://example.org/foo/bar}
+CFG: {b'x.prefix': b'http://example.org/foo', b'y.prefix': b'http://example.org/foo/bar'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -160,7 +160,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: *, y.prefix: https://example.org/bar}
+CFG: {b'x.prefix': b'*', b'y.prefix': b'https://example.org/bar'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -180,13 +180,13 @@
 
 *** Test user matching
 
-CFG: {x.password: xpassword, x.prefix: http://example.org/foo, x.username: None}
+CFG: {b'x.password': b'xpassword', b'x.prefix': b'http://example.org/foo', b'x.username': None}
 URI: http://y@example.org/foo
      ('y', 'xpassword')
-CFG: {x.password: xpassword, x.prefix: http://example.org/foo, x.username: None, y.password: ypassword, y.prefix: http://example.org/foo, y.username: y}
+CFG: {b'x.password': b'xpassword', b'x.prefix': b'http://example.org/foo', b'x.username': None, b'y.password': b'ypassword', b'y.prefix': b'http://example.org/foo', b'y.username': b'y'}
 URI: http://y@example.org/foo
      ('y', 'ypassword')
-CFG: {x.password: xpassword, x.prefix: http://example.org/foo/bar, x.username: None, y.password: ypassword, y.prefix: http://example.org/foo, y.username: y}
+CFG: {b'x.password': b'xpassword', b'x.prefix': b'http://example.org/foo/bar', b'x.username': None, b'y.password': b'ypassword', b'y.prefix': b'http://example.org/foo', b'y.username': b'y'}
 URI: http://y@example.org/foo/bar
      ('y', 'xpassword')
 
diff --git a/tests/test-hgweb-auth.py b/tests/test-hgweb-auth.py
--- a/tests/test-hgweb-auth.py
+++ b/tests/test-hgweb-auth.py
@@ -3,10 +3,14 @@
 from mercurial import demandimport; demandimport.enable()
 from mercurial import (
     error,
+    pycompat,
     ui as uimod,
     url,
     util,
 )
+from mercurial.utils import (
+    stringutil,
+)
 
 urlerr = util.urlerr
 urlreq = util.urlreq
@@ -23,12 +27,8 @@
         ui.setconfig('auth', name, value)
     return ui
 
-def dumpdict(dict):
-    return '{' + ', '.join(['%s: %s' % (k, dict[k])
-                            for k in sorted(dict)]) + '}'
-
 def test(auth, urls=None):
-    print('CFG:', dumpdict(auth))
+    print('CFG:', pycompat.sysstr(stringutil.pprint(auth)))
     prefixes = set()
     for k in auth:
         prefixes.add(k.split('.', 1)[0])



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


More information about the Mercurial-devel mailing list