77 def cleanup_exit(): |
77 def cleanup_exit(): |
78 if verbose: |
78 if verbose: |
79 print "# Cleaning up HGTMP", HGTMP |
79 print "# Cleaning up HGTMP", HGTMP |
80 shutil.rmtree(HGTMP, True) |
80 shutil.rmtree(HGTMP, True) |
81 |
81 |
|
82 def use_correct_python(): |
|
83 # some tests run python interpreter. they must use same |
|
84 # interpreter we use or bad things will happen. |
|
85 exedir, exename = os.path.split(sys.executable) |
|
86 if exename == 'python': |
|
87 path = find_program('python') |
|
88 if os.path.dirname(path) == exedir: |
|
89 return |
|
90 vlog('# Making python executable in test path use correct Python') |
|
91 my_python = os.path.join(BINDIR, 'python') |
|
92 try: |
|
93 os.symlink(sys.executable, my_python) |
|
94 except AttributeError: |
|
95 # windows fallback |
|
96 shutil.copyfile(sys.executable, my_python) |
|
97 shutil.copymode(sys.executable, my_python) |
|
98 |
82 def install_hg(): |
99 def install_hg(): |
83 vlog("# Performing temporary installation of HG") |
100 vlog("# Performing temporary installation of HG") |
84 installerrs = os.path.join("tests", "install.err") |
101 installerrs = os.path.join("tests", "install.err") |
85 |
102 |
86 os.chdir("..") # Get back to hg root |
103 os.chdir("..") # Get back to hg root |
99 sys.exit(1) |
116 sys.exit(1) |
100 os.chdir(TESTDIR) |
117 os.chdir(TESTDIR) |
101 |
118 |
102 os.environ["PATH"] = "%s%s%s" % (BINDIR, os.pathsep, os.environ["PATH"]) |
119 os.environ["PATH"] = "%s%s%s" % (BINDIR, os.pathsep, os.environ["PATH"]) |
103 os.environ["PYTHONPATH"] = PYTHONDIR |
120 os.environ["PYTHONPATH"] = PYTHONDIR |
|
121 |
|
122 use_correct_python() |
104 |
123 |
105 if coverage: |
124 if coverage: |
106 vlog("# Installing coverage wrapper") |
125 vlog("# Installing coverage wrapper") |
107 os.environ['COVERAGE_FILE'] = COVERAGE_FILE |
126 os.environ['COVERAGE_FILE'] = COVERAGE_FILE |
108 if os.path.exists(COVERAGE_FILE): |
127 if os.path.exists(COVERAGE_FILE): |