diff -r 57875cf423c9 -r 2372284d9457 tests/test-config-env.py --- a/tests/test-config-env.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/test-config-env.py Sun Oct 06 09:45:02 2019 -0400 @@ -11,9 +11,7 @@ util, ) -from mercurial.utils import ( - procutil, -) +from mercurial.utils import procutil testtmp = encoding.environ[b'TESTTMP'] @@ -21,6 +19,7 @@ def join(name): return os.path.join(testtmp, name) + with open(join(b'sysrc'), 'wb') as f: f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n') @@ -31,24 +30,28 @@ def systemrcpath(): return [join(b'sysrc')] + def userrcpath(): return [join(b'userrc')] + rcutil.systemrcpath = systemrcpath rcutil.userrcpath = userrcpath -os.path.isdir = lambda x: False # hack: do not load default.d/*.rc +os.path.isdir = lambda x: False # hack: do not load default.d/*.rc # utility to print configs def printconfigs(env): encoding.environ = env - rcutil._rccomponents = None # reset cache + rcutil._rccomponents = None # reset cache ui = uimod.ui.load() for section, name, value in ui.walkconfig(): source = ui.configsource(section, name) - procutil.stdout.write(b'%s.%s=%s # %s\n' - % (section, name, value, util.pconvert(source))) + procutil.stdout.write( + b'%s.%s=%s # %s\n' % (section, name, value, util.pconvert(source)) + ) procutil.stdout.write(b'\n') + # environment variable overrides printconfigs({}) printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'})