tests/run-tests.py
changeset 8724 6e41d3c5619f
parent 8696 73aa0510740d
child 8843 eb7b247a98ea
--- a/tests/run-tests.py	Sat Jun 06 13:37:41 2009 -0700
+++ b/tests/run-tests.py	Sat Jun 06 15:38:03 2009 -0700
@@ -759,12 +759,18 @@
         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")