Show More
@@ -1019,6 +1019,34 b' class TestRunner(object):' | |||
|
1019 | 1019 | return self._run(tests) |
|
1020 | 1020 | |
|
1021 | 1021 | def _run(self, tests): |
|
1022 | if self.options.with_hg: | |
|
1023 | self.inst = None | |
|
1024 | self.bindir = os.path.dirname(os.path.realpath( | |
|
1025 | self.options.with_hg)) | |
|
1026 | self.tmpbindir = os.path.join(self.hgtmp, 'install', 'bin') | |
|
1027 | os.makedirs(self.tmpbindir) | |
|
1028 | ||
|
1029 | # This looks redundant with how Python initializes sys.path from | |
|
1030 | # the location of the script being executed. Needed because the | |
|
1031 | # "hg" specified by --with-hg is not the only Python script | |
|
1032 | # executed in the test suite that needs to import 'mercurial' | |
|
1033 | # ... which means it's not really redundant at all. | |
|
1034 | self.pythondir = self.bindir | |
|
1035 | else: | |
|
1036 | self.inst = os.path.join(self.hgtmp, "install") | |
|
1037 | self.bindir = os.environ["BINDIR"] = os.path.join(self.inst, | |
|
1038 | "bin") | |
|
1039 | self.tmpbindir = self.bindir | |
|
1040 | self.pythondir = os.path.join(self.inst, "lib", "python") | |
|
1041 | ||
|
1042 | os.environ["BINDIR"] = self.bindir | |
|
1043 | os.environ["PYTHON"] = PYTHON | |
|
1044 | ||
|
1045 | path = [self.bindir] + os.environ["PATH"].split(os.pathsep) | |
|
1046 | if self.tmpbindir != self.bindir: | |
|
1047 | path = [self.tmpbindir] + path | |
|
1048 | os.environ["PATH"] = os.pathsep.join(path) | |
|
1049 | ||
|
1022 | 1050 | # Include TESTDIR in PYTHONPATH so that out-of-tree extensions |
|
1023 | 1051 | # can run .../tests/run-tests.py test-foo where test-foo |
|
1024 | 1052 | # adds an extension to HGRC. Also include run-test.py directory to |
@@ -1434,33 +1462,6 b' def main(args, runner=None, parser=None)' | |||
|
1434 | 1462 | tmpdir = tempfile.mkdtemp('', 'hgtests.', d) |
|
1435 | 1463 | runner.hgtmp = os.environ['HGTMP'] = os.path.realpath(tmpdir) |
|
1436 | 1464 | |
|
1437 | if options.with_hg: | |
|
1438 | runner.inst = None | |
|
1439 | runner.bindir = os.path.dirname(os.path.realpath(options.with_hg)) | |
|
1440 | runner.tmpbindir = os.path.join(runner.hgtmp, 'install', 'bin') | |
|
1441 | os.makedirs(runner.tmpbindir) | |
|
1442 | ||
|
1443 | # This looks redundant with how Python initializes sys.path from | |
|
1444 | # the location of the script being executed. Needed because the | |
|
1445 | # "hg" specified by --with-hg is not the only Python script | |
|
1446 | # executed in the test suite that needs to import 'mercurial' | |
|
1447 | # ... which means it's not really redundant at all. | |
|
1448 | runner.pythondir = runner.bindir | |
|
1449 | else: | |
|
1450 | runner.inst = os.path.join(runner.hgtmp, "install") | |
|
1451 | runner.bindir = os.environ["BINDIR"] = os.path.join(runner.inst, | |
|
1452 | "bin") | |
|
1453 | runner.tmpbindir = runner.bindir | |
|
1454 | runner.pythondir = os.path.join(runner.inst, "lib", "python") | |
|
1455 | ||
|
1456 | os.environ["BINDIR"] = runner.bindir | |
|
1457 | os.environ["PYTHON"] = PYTHON | |
|
1458 | ||
|
1459 | path = [runner.bindir] + os.environ["PATH"].split(os.pathsep) | |
|
1460 | if runner.tmpbindir != runner.bindir: | |
|
1461 | path = [runner.tmpbindir] + path | |
|
1462 | os.environ["PATH"] = os.pathsep.join(path) | |
|
1463 | ||
|
1464 | 1465 | return runner.run(tests) |
|
1465 | 1466 | |
|
1466 | 1467 | if __name__ == '__main__': |
General Comments 0
You need to be logged in to leave comments.
Login now