Mercurial > hg-stable
changeset 28644:2e50eb6304bd
run-tests: add canonpath function
consistently use realpath+expanduser
author | timeless <timeless@mozdev.org> |
---|---|
date | Mon, 28 Mar 2016 04:01:21 +0000 |
parents | 392a7e7e97d3 |
children | c226e9b69bac |
files | tests/run-tests.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Mon Mar 28 03:40:30 2016 +0000 +++ b/tests/run-tests.py Mon Mar 28 04:01:21 2016 +0000 @@ -151,6 +151,9 @@ 'shell': ('HGTEST_SHELL', 'sh'), } +def canonpath(path): + return os.path.realpath(os.path.expanduser(path)) + def parselistfiles(files, listtype, warn=True): entries = dict() for filename in files: @@ -290,15 +293,14 @@ options.pure = True if options.with_hg: - options.with_hg = os.path.realpath( - os.path.expanduser(_bytespath(options.with_hg))) + options.with_hg = canonpath(_bytespath(options.with_hg)) if not (os.path.isfile(options.with_hg) and os.access(options.with_hg, os.X_OK)): parser.error('--with-hg must specify an executable hg script') if not os.path.basename(options.with_hg) == b'hg': sys.stderr.write('warning: --with-hg should specify an hg script\n') if options.local: - testdir = os.path.dirname(_bytespath(os.path.realpath(sys.argv[0]))) + testdir = os.path.dirname(_bytespath(canonpath(sys.argv[0]))) hgbin = os.path.join(os.path.dirname(testdir), b'hg') if os.name != 'nt' and not os.access(hgbin, os.X_OK): parser.error('--local specified, but %r not found or not executable' @@ -309,8 +311,7 @@ parser.error('chg does not work on %s' % os.name) if options.with_chg: options.chg = False # no installation to temporary location - options.with_chg = os.path.realpath( - os.path.expanduser(_bytespath(options.with_chg))) + options.with_chg = canonpath(_bytespath(options.with_chg)) if not (os.path.isfile(options.with_chg) and os.access(options.with_chg, os.X_OK)): parser.error('--with-chg must specify a chg executable') @@ -343,7 +344,7 @@ verbose = '' if options.tmpdir: - options.tmpdir = os.path.expanduser(options.tmpdir) + options.tmpdir = canonpath(options.tmpdir) if options.jobs < 1: parser.error('--jobs must be positive')