diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -759,12 +759,18 @@ def main(): path = [BINDIR] + os.environ["PATH"].split(os.pathsep) 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 + pypath = [PYTHONDIR, TESTDIR] # 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.) - os.environ["PYTHONPATH"] = (PYTHONDIR + os.pathsep + - os.environ.get("PYTHONPATH", "")) + oldpypath = os.environ.get('PYTHONPATH') + if oldpypath: + pypath.append(oldpypath) + os.environ['PYTHONPATH'] = os.pathsep.join(pypath) COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")