##// END OF EJS Templates
run-tests: move pypath manipulation into TestRunner
Gregory Szorc -
r21367:522e3d24 default
parent child Browse files
Show More
@@ -1019,6 +1019,23 b' class TestRunner(object):'
1019 return self._run(tests)
1019 return self._run(tests)
1020
1020
1021 def _run(self, tests):
1021 def _run(self, tests):
1022 # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
1023 # can run .../tests/run-tests.py test-foo where test-foo
1024 # adds an extension to HGRC. Also include run-test.py directory to
1025 # import modules like heredoctest.
1026 pypath = [self.pythondir, self.testdir,
1027 os.path.abspath(os.path.dirname(__file__))]
1028 # We have to augment PYTHONPATH, rather than simply replacing
1029 # it, in case external libraries are only available via current
1030 # PYTHONPATH. (In particular, the Subversion bindings on OS X
1031 # are in /opt/subversion.)
1032 oldpypath = os.environ.get(IMPL_PATH)
1033 if oldpypath:
1034 pypath.append(oldpypath)
1035 os.environ[IMPL_PATH] = os.pathsep.join(pypath)
1036
1037 self.coveragefile = os.path.join(self.testdir, '.coverage')
1038
1022 vlog("# Using TESTDIR", self.testdir)
1039 vlog("# Using TESTDIR", self.testdir)
1023 vlog("# Using HGTMP", self.hgtmp)
1040 vlog("# Using HGTMP", self.hgtmp)
1024 vlog("# Using PATH", os.environ["PATH"])
1041 vlog("# Using PATH", os.environ["PATH"])
@@ -1444,23 +1461,6 b' def main(args, runner=None, parser=None)'
1444 path = [runner.tmpbindir] + path
1461 path = [runner.tmpbindir] + path
1445 os.environ["PATH"] = os.pathsep.join(path)
1462 os.environ["PATH"] = os.pathsep.join(path)
1446
1463
1447 # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
1448 # can run .../tests/run-tests.py test-foo where test-foo
1449 # adds an extension to HGRC. Also include run-test.py directory to import
1450 # modules like heredoctest.
1451 pypath = [runner.pythondir, runner.testdir,
1452 os.path.abspath(os.path.dirname(__file__))]
1453 # We have to augment PYTHONPATH, rather than simply replacing
1454 # it, in case external libraries are only available via current
1455 # PYTHONPATH. (In particular, the Subversion bindings on OS X
1456 # are in /opt/subversion.)
1457 oldpypath = os.environ.get(IMPL_PATH)
1458 if oldpypath:
1459 pypath.append(oldpypath)
1460 os.environ[IMPL_PATH] = os.pathsep.join(pypath)
1461
1462 runner.coveragefile = os.path.join(runner.testdir, ".coverage")
1463
1464 return runner.run(tests)
1464 return runner.run(tests)
1465
1465
1466 if __name__ == '__main__':
1466 if __name__ == '__main__':
General Comments 0
You need to be logged in to leave comments. Login now