Mercurial > hg-stable
changeset 2570:2264b2b077a1
run-tests.py: make tests use same python interpreter as test harness.
this is wanted because some tests run python interpreter directly.
must use same python interpreter in tests as in main harness or problems
will happen because of e.g. different python abi if run-tests.py run
with python 2.5 but system python is 2.4.
fix is to see if system python is used and is named python. if no,
put symlink called python at front of shell search path.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Thu, 06 Jul 2006 10:09:24 -0700 |
parents | 52ce0d6bc375 |
children | 83cfd95eafb5 |
files | tests/run-tests.py |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Thu Jul 06 03:14:55 2006 -0300 +++ b/tests/run-tests.py Thu Jul 06 10:09:24 2006 -0700 @@ -79,6 +79,23 @@ print "# Cleaning up HGTMP", HGTMP shutil.rmtree(HGTMP, True) +def use_correct_python(): + # some tests run python interpreter. they must use same + # interpreter we use or bad things will happen. + exedir, exename = os.path.split(sys.executable) + if exename == 'python': + path = find_program('python') + if os.path.dirname(path) == exedir: + return + vlog('# Making python executable in test path use correct Python') + my_python = os.path.join(BINDIR, 'python') + try: + os.symlink(sys.executable, my_python) + except AttributeError: + # windows fallback + shutil.copyfile(sys.executable, my_python) + shutil.copymode(sys.executable, my_python) + def install_hg(): vlog("# Performing temporary installation of HG") installerrs = os.path.join("tests", "install.err") @@ -102,6 +119,8 @@ os.environ["PATH"] = "%s%s%s" % (BINDIR, os.pathsep, os.environ["PATH"]) os.environ["PYTHONPATH"] = PYTHONDIR + use_correct_python() + if coverage: vlog("# Installing coverage wrapper") os.environ['COVERAGE_FILE'] = COVERAGE_FILE