changeset 8724:6e41d3c5619f

Unbreak run-tests support for out-of-tree extensions
author Brendan Cully <brendan@kublai.com>
date Sat, 06 Jun 2009 15:38:03 -0700
parents b4a1b9012d96
children 353b1c160c2d
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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")