Patchwork run-tests: fix heredoctest for out-of-tree extensions

login
register
mail settings
Submitter Patrick Mezard
Date Feb. 15, 2014, 4:06 p.m.
Message ID <e0917bcc3140e482ce2e.1392480404@pangolin.local>
Download mbox | patch
Permalink /patch/3674/
State Accepted
Commit dcd3bebf478607bd821d8617fc74b7edebd99fe8
Headers show

Comments

Patrick Mezard - Feb. 15, 2014, 4:06 p.m.
# HG changeset patch
# User Patrick Mezard <patrick@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
Matt Mackall - Feb. 16, 2014, 1:17 a.m.
On Sat, 2014-02-15 at 17:06 +0100, Patrick Mezard wrote:
> # HG changeset patch
> # User Patrick Mezard <patrick@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

Queued for default, thanks.

Patch

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