393 help="use specified chg wrapper in place of hg") |
393 help="use specified chg wrapper in place of hg") |
394 hgconf.add_argument("--with-hg", |
394 hgconf.add_argument("--with-hg", |
395 metavar="HG", |
395 metavar="HG", |
396 help="test using specified hg script rather than a " |
396 help="test using specified hg script rather than a " |
397 "temporary installation") |
397 "temporary installation") |
398 # This option should be deleted once test-check-py3-compat.t and other |
|
399 # Python 3 tests run with Python 3. |
|
400 hgconf.add_argument("--with-python3", metavar="PYTHON3", |
|
401 help="Python 3 interpreter (if running under Python 2)" |
|
402 " (TEMPORARY)") |
|
403 |
398 |
404 reporting = parser.add_argument_group('Results Reporting') |
399 reporting = parser.add_argument_group('Results Reporting') |
405 reporting.add_argument("-C", "--annotate", action="store_true", |
400 reporting.add_argument("-C", "--annotate", action="store_true", |
406 help="output files annotated with coverage") |
401 help="output files annotated with coverage") |
407 reporting.add_argument("--color", choices=["always", "auto", "never"], |
402 reporting.add_argument("--color", choices=["always", "auto", "never"], |
531 options.slowtimeout = 0 |
526 options.slowtimeout = 0 |
532 if options.py3k_warnings: |
527 if options.py3k_warnings: |
533 if PYTHON3: |
528 if PYTHON3: |
534 parser.error( |
529 parser.error( |
535 '--py3k-warnings can only be used on Python 2.7') |
530 '--py3k-warnings can only be used on Python 2.7') |
536 if options.with_python3: |
|
537 if PYTHON3: |
|
538 parser.error('--with-python3 cannot be used when executing with ' |
|
539 'Python 3') |
|
540 |
|
541 options.with_python3 = canonpath(options.with_python3) |
|
542 # Verify Python3 executable is acceptable. |
|
543 proc = subprocess.Popen([options.with_python3, b'--version'], |
|
544 stdout=subprocess.PIPE, |
|
545 stderr=subprocess.STDOUT) |
|
546 out, _err = proc.communicate() |
|
547 ret = proc.wait() |
|
548 if ret != 0: |
|
549 parser.error('could not determine version of python 3') |
|
550 if not out.startswith('Python '): |
|
551 parser.error('unexpected output from python3 --version: %s' % |
|
552 out) |
|
553 vers = version.LooseVersion(out[len('Python '):]) |
|
554 if vers < version.LooseVersion('3.5.0'): |
|
555 parser.error('--with-python3 version must be 3.5.0 or greater; ' |
|
556 'got %s' % out) |
|
557 |
531 |
558 if options.blacklist: |
532 if options.blacklist: |
559 options.blacklist = parselistfiles(options.blacklist, 'blacklist') |
533 options.blacklist = parselistfiles(options.blacklist, 'blacklist') |
560 if options.whitelist: |
534 if options.whitelist: |
561 options.whitelisted = parselistfiles(options.whitelist, 'whitelist') |
535 options.whitelisted = parselistfiles(options.whitelist, 'whitelist') |
2609 self._hgcommand = os.path.basename(self.options.with_chg) |
2583 self._hgcommand = os.path.basename(self.options.with_chg) |
2610 |
2584 |
2611 osenvironb[b"BINDIR"] = self._bindir |
2585 osenvironb[b"BINDIR"] = self._bindir |
2612 osenvironb[b"PYTHON"] = PYTHON |
2586 osenvironb[b"PYTHON"] = PYTHON |
2613 |
2587 |
2614 if self.options.with_python3: |
|
2615 osenvironb[b'PYTHON3'] = self.options.with_python3 |
|
2616 |
|
2617 fileb = _bytespath(__file__) |
2588 fileb = _bytespath(__file__) |
2618 runtestdir = os.path.abspath(os.path.dirname(fileb)) |
2589 runtestdir = os.path.abspath(os.path.dirname(fileb)) |
2619 osenvironb[b'RUNTESTDIR'] = runtestdir |
2590 osenvironb[b'RUNTESTDIR'] = runtestdir |
2620 if PYTHON3: |
2591 if PYTHON3: |
2621 sepb = _bytespath(os.pathsep) |
2592 sepb = _bytespath(os.pathsep) |