Patchwork [1,of,5] run-tests: include testdir in $PATH so tests easily can use helper tools

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 14, 2015, 11:24 p.m.
Message ID <1b43d00b9a2551b3e70b.1421277876@localhost.localdomain>
Download mbox | patch
Permalink /patch/7456/
State Accepted
Commit 661b246bf1c4f43898ec6ba92b7e7bc6f20e3abd
Headers show

Comments

Mads Kiilerich - Jan. 14, 2015, 11:24 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1421194526 -3600
#      Wed Jan 14 01:15:26 2015 +0100
# Node ID 1b43d00b9a2551b3e70b09562e27c50c0cb6decd
# Parent  71402bb8d8b274d82169cf26253e38ef793794f5
run-tests: include testdir in $PATH so tests easily can use helper tools

The testdir is already added to $PYTHONPATH - I think it makes sense and is
convenient to add it to $PATH too.

The following binaries are invoked from tests using full path with $TESTDIR/ -
they can now be used without specifying path:
  dumbhttp.py
  dummyssh
  filterpyflakes.py
  generate-working-copy-states.py
  get-with-headers.py
  hghave
  histedit-helpers.sh
  killdaemons.py
  md5sum.py
  notcapable
  printenv.py
  readlink.py
  revlog-formatv0.py
  run-tests.py
  svn-safe-append.py
  svnxml.py
  tinyproxy.py

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1644,7 +1644,8 @@  class TestRunner(object):
         os.environ["BINDIR"] = self._bindir
         os.environ["PYTHON"] = PYTHON
 
-        path = [self._bindir] + os.environ["PATH"].split(os.pathsep)
+        runtestdir = os.path.abspath(os.path.dirname(__file__))
+        path = [self._bindir, runtestdir] + os.environ["PATH"].split(os.pathsep)
         if self._tmpbindir != self._bindir:
             path = [self._tmpbindir] + path
         os.environ["PATH"] = os.pathsep.join(path)
@@ -1653,8 +1654,7 @@  class TestRunner(object):
         # can run .../tests/run-tests.py test-foo where test-foo
         # adds an extension to HGRC. Also include run-test.py directory to
         # import modules like heredoctest.
-        pypath = [self._pythondir, self._testdir,
-                  os.path.abspath(os.path.dirname(__file__))]
+        pypath = [self._pythondir, self._testdir, runtestdir]
         # 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