##// END OF EJS Templates
run-tests: add --with-python3 to define a Python 3 interpreter...
Gregory Szorc -
r28582:cdbc2530 default
parent child Browse files
Show More
@@ -443,6 +443,10 b' def has_absimport():'
443 443 def has_py3k():
444 444 return 3 == sys.version_info[0]
445 445
446 @check("py3exe", "a Python 3.x interpreter is available")
447 def has_python3exe():
448 return 'PYTHON3' in os.environ
449
446 450 @check("pure", "running with pure Python code")
447 451 def has_pure():
448 452 return any([
@@ -255,6 +255,11 b' def getparser():'
255 255 help="use specified chg wrapper in place of hg")
256 256 parser.add_option("-3", "--py3k-warnings", action="store_true",
257 257 help="enable Py3k warnings on Python 2.6+")
258 # This option should be deleted once test-check-py3-compat.t and other
259 # Python 3 tests run with Python 3.
260 parser.add_option("--with-python3", metavar="PYTHON3",
261 help="Python 3 interpreter (if running under Python 2)"
262 " (TEMPORARY)")
258 263 parser.add_option('--extra-config-opt', action="append",
259 264 help='set the given config opt in the test hgrc')
260 265 parser.add_option('--random', action="store_true",
@@ -353,6 +358,27 b' def parseargs(args, parser):'
353 358 if PYTHON3:
354 359 parser.error(
355 360 '--py3k-warnings can only be used on Python 2.6 and 2.7')
361 if options.with_python3:
362 if PYTHON3:
363 parser.error('--with-python3 cannot be used when executing with '
364 'Python 3')
365
366 # Verify Python3 executable is acceptable.
367 proc = subprocess.Popen([options.with_python3, b'--version'],
368 stdout=subprocess.PIPE,
369 stderr=subprocess.STDOUT)
370 out, _err = proc.communicate()
371 ret = proc.wait()
372 if ret != 0:
373 parser.error('could not determine version of python 3')
374 if not out.startswith('Python '):
375 parser.error('unexpected output from python3 --version: %s' %
376 out)
377 vers = version.LooseVersion(out[len('Python '):])
378 if vers < version.LooseVersion('3.5.0'):
379 parser.error('--with-python3 version must be 3.5.0 or greater; '
380 'got %s' % out)
381
356 382 if options.blacklist:
357 383 options.blacklist = parselistfiles(options.blacklist, 'blacklist')
358 384 if options.whitelist:
@@ -1987,6 +2013,9 b' class TestRunner(object):'
1987 2013 osenvironb[b"BINDIR"] = self._bindir
1988 2014 osenvironb[b"PYTHON"] = PYTHON
1989 2015
2016 if self.options.with_python3:
2017 osenvironb[b'PYTHON3'] = self.options.with_python3
2018
1990 2019 fileb = _bytespath(__file__)
1991 2020 runtestdir = os.path.abspath(os.path.dirname(fileb))
1992 2021 osenvironb[b'RUNTESTDIR'] = runtestdir
General Comments 0
You need to be logged in to leave comments. Login now