Mercurial > hg
comparison tests/run-tests.py @ 42817:69506e1b3214
run-tests: handle --local before --with-hg
We no longer support them both together, so this is now safe to do. By
checking --local first, we avoid error out about an invalid --with-hg
script if --local was also given (we instead tell the user that the
options are mutually exclusive).
I also had to wrap the 'binpath' we pass to setattr() in _strpath() to
keep `python3 run-tests.py -l` working. That change also made `python3
run-tests.py -l --chg` work, which was the reason for this series.
Differential Revision: https://phab.mercurial-scm.org/D6760
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 23 Aug 2019 08:54:32 -0700 |
parents | fb84730d1c5a |
children | 141bb77b606b |
comparison
equal
deleted
inserted
replaced
42816:fb84730d1c5a | 42817:69506e1b3214 |
---|---|
482 | 482 |
483 # jython is always pure | 483 # jython is always pure |
484 if 'java' in sys.platform or '__pypy__' in sys.modules: | 484 if 'java' in sys.platform or '__pypy__' in sys.modules: |
485 options.pure = True | 485 options.pure = True |
486 | 486 |
487 if options.with_hg: | |
488 options.with_hg = canonpath(_bytespath(options.with_hg)) | |
489 if not (os.path.isfile(options.with_hg) and | |
490 os.access(options.with_hg, os.X_OK)): | |
491 parser.error('--with-hg must specify an executable hg script') | |
492 if os.path.basename(options.with_hg) not in [b'hg', b'hg.exe']: | |
493 sys.stderr.write('warning: --with-hg should specify an hg script\n') | |
494 sys.stderr.flush() | |
495 if options.local: | 487 if options.local: |
496 if options.with_hg or options.with_chg: | 488 if options.with_hg or options.with_chg: |
497 parser.error('--local cannot be used with --with-hg or --with-chg') | 489 parser.error('--local cannot be used with --with-hg or --with-chg') |
498 testdir = os.path.dirname(_bytespath(canonpath(sys.argv[0]))) | 490 testdir = os.path.dirname(_bytespath(canonpath(sys.argv[0]))) |
499 reporootdir = os.path.dirname(testdir) | 491 reporootdir = os.path.dirname(testdir) |
503 for relpath, attr in pathandattrs: | 495 for relpath, attr in pathandattrs: |
504 binpath = os.path.join(reporootdir, relpath) | 496 binpath = os.path.join(reporootdir, relpath) |
505 if os.name != 'nt' and not os.access(binpath, os.X_OK): | 497 if os.name != 'nt' and not os.access(binpath, os.X_OK): |
506 parser.error('--local specified, but %r not found or ' | 498 parser.error('--local specified, but %r not found or ' |
507 'not executable' % binpath) | 499 'not executable' % binpath) |
508 setattr(options, attr, binpath) | 500 setattr(options, attr, _strpath(binpath)) |
501 | |
502 if options.with_hg: | |
503 options.with_hg = canonpath(_bytespath(options.with_hg)) | |
504 if not (os.path.isfile(options.with_hg) and | |
505 os.access(options.with_hg, os.X_OK)): | |
506 parser.error('--with-hg must specify an executable hg script') | |
507 if os.path.basename(options.with_hg) not in [b'hg', b'hg.exe']: | |
508 sys.stderr.write('warning: --with-hg should specify an hg script\n') | |
509 sys.stderr.flush() | |
509 | 510 |
510 if (options.chg or options.with_chg) and os.name == 'nt': | 511 if (options.chg or options.with_chg) and os.name == 'nt': |
511 parser.error('chg does not work on %s' % os.name) | 512 parser.error('chg does not work on %s' % os.name) |
512 if options.with_chg: | 513 if options.with_chg: |
513 options.chg = False # no installation to temporary location | 514 options.chg = False # no installation to temporary location |