Show More
@@ -398,14 +398,14 b' def cleanup(runner, options):' | |||
|
398 | 398 | except OSError: |
|
399 | 399 | pass |
|
400 | 400 | |
|
401 | def usecorrectpython(): | |
|
401 | def usecorrectpython(runner): | |
|
402 | 402 | # some tests run python interpreter. they must use same |
|
403 | 403 | # interpreter we use or bad things will happen. |
|
404 | 404 | pyexename = sys.platform == 'win32' and 'python.exe' or 'python' |
|
405 | 405 | if getattr(os, 'symlink', None): |
|
406 | 406 | vlog("# Making python executable in test path a symlink to '%s'" % |
|
407 | 407 | sys.executable) |
|
408 |
mypython = os.path.join( |
|
|
408 | mypython = os.path.join(runner.tmpbindir, pyexename) | |
|
409 | 409 | try: |
|
410 | 410 | if os.readlink(mypython) == sys.executable: |
|
411 | 411 | return |
@@ -475,7 +475,7 b' def installhg(runner, options):' | |||
|
475 | 475 | sys.exit(1) |
|
476 | 476 | os.chdir(runner.testdir) |
|
477 | 477 | |
|
478 | usecorrectpython() | |
|
478 | usecorrectpython(runner) | |
|
479 | 479 | |
|
480 | 480 | if options.py3k_warnings and not options.anycoverage: |
|
481 | 481 | vlog("# Updating hg command to enable Py3k Warnings switch") |
@@ -1231,7 +1231,7 b' def runtests(runner, options, tests):' | |||
|
1231 | 1231 | installhg(runner, options) |
|
1232 | 1232 | _checkhglib("Testing") |
|
1233 | 1233 | else: |
|
1234 | usecorrectpython() | |
|
1234 | usecorrectpython(runner) | |
|
1235 | 1235 | |
|
1236 | 1236 | if options.restart: |
|
1237 | 1237 | orig = list(tests) |
@@ -1291,6 +1291,7 b' class TestRunner(object):' | |||
|
1291 | 1291 | self.hgtmp = None |
|
1292 | 1292 | self.inst = None |
|
1293 | 1293 | self.bindir = None |
|
1294 | self.tmpbinddir = None | |
|
1294 | 1295 | |
|
1295 | 1296 | def main(args, parser=None): |
|
1296 | 1297 | runner = TestRunner() |
@@ -1338,7 +1339,7 b' def main(args, parser=None):' | |||
|
1338 | 1339 | # we do the randomness ourself to know what seed is used |
|
1339 | 1340 | os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32)) |
|
1340 | 1341 | |
|
1341 |
global |
|
|
1342 | global PYTHONDIR, COVERAGE_FILE | |
|
1342 | 1343 | runner.testdir = os.environ['TESTDIR'] = os.getcwd() |
|
1343 | 1344 | if options.tmpdir: |
|
1344 | 1345 | options.keep_tmpdir = True |
@@ -1368,8 +1369,8 b' def main(args, parser=None):' | |||
|
1368 | 1369 | if options.with_hg: |
|
1369 | 1370 | runner.inst = None |
|
1370 | 1371 | runner.bindir = os.path.dirname(os.path.realpath(options.with_hg)) |
|
1371 |
|
|
|
1372 |
os.makedirs( |
|
|
1372 | runner.tmpbindir = os.path.join(runner.hgtmp, 'install', 'bin') | |
|
1373 | os.makedirs(runner.tmpbindir) | |
|
1373 | 1374 | |
|
1374 | 1375 | # This looks redundant with how Python initializes sys.path from |
|
1375 | 1376 | # the location of the script being executed. Needed because the |
@@ -1381,15 +1382,15 b' def main(args, parser=None):' | |||
|
1381 | 1382 | runner.inst = os.path.join(runner.hgtmp, "install") |
|
1382 | 1383 | runner.bindir = os.environ["BINDIR"] = os.path.join(runner.inst, |
|
1383 | 1384 | "bin") |
|
1384 |
|
|
|
1385 | runner.tmpbindir = runner.bindir | |
|
1385 | 1386 | PYTHONDIR = os.path.join(runner.inst, "lib", "python") |
|
1386 | 1387 | |
|
1387 | 1388 | os.environ["BINDIR"] = runner.bindir |
|
1388 | 1389 | os.environ["PYTHON"] = PYTHON |
|
1389 | 1390 | |
|
1390 | 1391 | path = [runner.bindir] + os.environ["PATH"].split(os.pathsep) |
|
1391 |
if |
|
|
1392 |
path = [ |
|
|
1392 | if runner.tmpbindir != runner.bindir: | |
|
1393 | path = [runner.tmpbindir] + path | |
|
1393 | 1394 | os.environ["PATH"] = os.pathsep.join(path) |
|
1394 | 1395 | |
|
1395 | 1396 | # Include TESTDIR in PYTHONPATH so that out-of-tree extensions |
General Comments 0
You need to be logged in to leave comments.
Login now