diff --git a/tests/test-config-env.py b/tests/test-config-env.py
--- a/tests/test-config-env.py
+++ b/tests/test-config-env.py
@@ -8,6 +8,7 @@ from mercurial import (
     encoding,
     rcutil,
     ui as uimod,
+    util,
 )
 
 testtmp = encoding.environ['TESTTMP']
@@ -40,7 +41,7 @@ def printconfigs(env):
     ui = uimod.ui.load()
     for section, name, value in ui.walkconfig():
         source = ui.configsource(section, name)
-        print('%s.%s=%s # %s' % (section, name, value, source))
+        print('%s.%s=%s # %s' % (section, name, value, util.pconvert(source)))
     print('')
 
 # environment variable overrides
diff --git a/tests/test-trusted.py b/tests/test-trusted.py
--- a/tests/test-trusted.py
+++ b/tests/test-trusted.py
@@ -74,14 +74,14 @@ def testui(user='foo', group='bar', tuse
         return u
     print('trusted')
     for name, path in u.configitems('paths'):
-        print('   ', name, '=', path)
+        print('   ', name, '=', util.pconvert(path))
     print('untrusted')
     for name, path in u.configitems('paths', untrusted=True):
         print('.', end=' ')
         u.config('paths', name) # warning with debug=True
         print('.', end=' ')
         u.config('paths', name, untrusted=True) # no warnings
-        print(name, '=', path)
+        print(name, '=', util.pconvert(path))
     print()
 
     return u
@@ -217,6 +217,12 @@ bytes=81mb
 list=spam,ham,eggs
 ''')
 u = testui(user='abc', group='def', cuser='foo', silent=True)
+def configpath(section, name, default=None, untrusted=False):
+    path = u.configpath(section, name, default, untrusted)
+    if path is None:
+        return None
+    return util.pconvert(path)
+
 print('# suboptions, trusted and untrusted')
 trusted = u.configsuboptions('foo', 'sub')
 untrusted = u.configsuboptions('foo', 'sub', untrusted=True)
@@ -224,7 +230,7 @@ print(
     (trusted[0], sorted(trusted[1].items())),
     (untrusted[0], sorted(untrusted[1].items())))
 print('# path, trusted and untrusted')
-print(u.configpath('foo', 'path'), u.configpath('foo', 'path', untrusted=True))
+print(configpath('foo', 'path'), configpath('foo', 'path', untrusted=True))
 print('# bool, trusted and untrusted')
 print(u.configbool('foo', 'bool'), u.configbool('foo', 'bool', untrusted=True))
 print('# int, trusted and untrusted')