--- a/tests/run-tests.py Sun Apr 20 09:49:33 2014 -0700
+++ b/tests/run-tests.py Sun Apr 20 09:54:28 2014 -0700
@@ -1019,6 +1019,23 @@
return self._run(tests)
def _run(self, tests):
+ # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
+ # can run .../tests/run-tests.py test-foo where test-foo
+ # adds an extension to HGRC. Also include run-test.py directory to
+ # import modules like heredoctest.
+ pypath = [self.pythondir, self.testdir,
+ os.path.abspath(os.path.dirname(__file__))]
+ # We have to augment PYTHONPATH, rather than simply replacing
+ # it, in case external libraries are only available via current
+ # PYTHONPATH. (In particular, the Subversion bindings on OS X
+ # are in /opt/subversion.)
+ oldpypath = os.environ.get(IMPL_PATH)
+ if oldpypath:
+ pypath.append(oldpypath)
+ os.environ[IMPL_PATH] = os.pathsep.join(pypath)
+
+ self.coveragefile = os.path.join(self.testdir, '.coverage')
+
vlog("# Using TESTDIR", self.testdir)
vlog("# Using HGTMP", self.hgtmp)
vlog("# Using PATH", os.environ["PATH"])
@@ -1444,23 +1461,6 @@
path = [runner.tmpbindir] + path
os.environ["PATH"] = os.pathsep.join(path)
- # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
- # can run .../tests/run-tests.py test-foo where test-foo
- # adds an extension to HGRC. Also include run-test.py directory to import
- # modules like heredoctest.
- pypath = [runner.pythondir, runner.testdir,
- os.path.abspath(os.path.dirname(__file__))]
- # We have to augment PYTHONPATH, rather than simply replacing
- # it, in case external libraries are only available via current
- # PYTHONPATH. (In particular, the Subversion bindings on OS X
- # are in /opt/subversion.)
- oldpypath = os.environ.get(IMPL_PATH)
- if oldpypath:
- pypath.append(oldpypath)
- os.environ[IMPL_PATH] = os.pathsep.join(pypath)
-
- runner.coveragefile = os.path.join(runner.testdir, ".coverage")
-
return runner.run(tests)
if __name__ == '__main__':