[PATCH] tests: print Unix style paths in *.py tests
Ryan McElroy
rm at fb.com
Mon Apr 10 05:25:03 EDT 2017
On 4/10/17 3:24 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1491790767 14400
> # Sun Apr 09 22:19:27 2017 -0400
> # Node ID f5ea3f4ee8206f99c7038814e87b34ae3124be98
> # Parent 548c1c174b937b1512ea689661c591dcf778ebe1
> tests: print Unix style paths in *.py tests
Makes sense to me. Marked as pre-reviewed in patchwork.
>
> These tests don't support (glob). I didn't audit all tests, but these ones were
> failing.
>
> 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 @@
> 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
> 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 @@
> 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')
>
More information about the Mercurial-devel
mailing list