[PATCH] run-tests: fix heredoctest for out-of-tree extensions

Patrick Mezard patrick at mezard.eu
Sat Feb 15 10:06:44 CST 2014


# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1392474512 -3600
#      Sat Feb 15 15:28:32 2014 +0100
# Node ID e0917bcc3140e482ce2ed64519eb93182305ca42
# Parent  e5a2177d97f04e851cede67712ec6ecbc72818d7
run-tests: fix heredoctest for out-of-tree extensions

heredoctest.py directory must be in python path to use heredoctest (>>>) in
out-of-tree extension tests like:

  $ cd ext/tests
  $ python /some/hg/install/tests/run-tests.py test-ext.t

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1255,8 +1255,9 @@
 
     # 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]
+    # adds an extension to HGRC. Also include run-test.py directory to import
+    # modules like heredoctest.
+    pypath = [PYTHONDIR, 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


More information about the Mercurial-devel mailing list