Mercurial > hg
comparison tests/run-tests.py @ 29582:ee96d95e81a4
run-tests: allow --local to set multiple attributes
This is to make the next patch easier to review. It does not change logic.
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 18 Jul 2016 08:45:46 +0100 |
parents | 348b2b9da703 |
children | 6ce870dba6fa |
comparison
equal
deleted
inserted
replaced
29581:c66bc06f1bf6 | 29582:ee96d95e81a4 |
---|---|
306 parser.error('--with-hg must specify an executable hg script') | 306 parser.error('--with-hg must specify an executable hg script') |
307 if not os.path.basename(options.with_hg) == b'hg': | 307 if not os.path.basename(options.with_hg) == b'hg': |
308 sys.stderr.write('warning: --with-hg should specify an hg script\n') | 308 sys.stderr.write('warning: --with-hg should specify an hg script\n') |
309 if options.local: | 309 if options.local: |
310 testdir = os.path.dirname(_bytespath(canonpath(sys.argv[0]))) | 310 testdir = os.path.dirname(_bytespath(canonpath(sys.argv[0]))) |
311 hgbin = os.path.join(os.path.dirname(testdir), b'hg') | 311 reporootdir = os.path.dirname(testdir) |
312 if os.name != 'nt' and not os.access(hgbin, os.X_OK): | 312 pathandattrs = [(b'hg', 'with_hg')] |
313 parser.error('--local specified, but %r not found or not executable' | 313 for relpath, attr in pathandattrs: |
314 % hgbin) | 314 binpath = os.path.join(reporootdir, relpath) |
315 options.with_hg = hgbin | 315 if os.name != 'nt' and not os.access(binpath, os.X_OK): |
316 parser.error('--local specified, but %r not found or ' | |
317 'not executable' % binpath) | |
318 setattr(options, attr, binpath) | |
316 | 319 |
317 if (options.chg or options.with_chg) and os.name == 'nt': | 320 if (options.chg or options.with_chg) and os.name == 'nt': |
318 parser.error('chg does not work on %s' % os.name) | 321 parser.error('chg does not work on %s' % os.name) |
319 if options.with_chg: | 322 if options.with_chg: |
320 options.chg = False # no installation to temporary location | 323 options.chg = False # no installation to temporary location |