Mercurial > hg
changeset 31857:08fbc97d1364
tests: print Unix style paths in *.py tests
These tests don't support (glob). I didn't audit all tests, but these ones were
failing.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 09 Apr 2017 22:19:27 -0400 |
parents | 0ab7f469d386 |
children | ad366d57d574 |
files | tests/test-config-env.py tests/test-trusted.py |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-config-env.py Sun Apr 09 12:53:31 2017 -0700 +++ b/tests/test-config-env.py Sun Apr 09 22:19:27 2017 -0400 @@ -8,6 +8,7 @@ encoding, rcutil, ui as uimod, + util, ) testtmp = encoding.environ['TESTTMP'] @@ -40,7 +41,7 @@ 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
--- a/tests/test-trusted.py Sun Apr 09 12:53:31 2017 -0700 +++ b/tests/test-trusted.py Sun Apr 09 22:19:27 2017 -0400 @@ -74,14 +74,14 @@ 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 @@ 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 @@ (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')