# HG changeset patch # User Pierre-Yves David # Date 1428777852 14400 # Node ID 39ee0444e27c978f101b02c4ad68527e55de9d18 # Parent bb67e52362d6eb9cfd9e41f710ccd5caa05f85b1 run-tests: also follow symlink when update PATH with 'run-tests.py' dir I'm using 'run-tests.py' from my '$PATH' and use a symlink to get 'run-tests.py' to in that '$PATH'. There is a handful of test helpers (like f) that needs to be in the '$PATH' for the test to run, and they are expected to live next to the 'run-tests.py' binary. Using a symlink confuses this logic, so we add to the '$PATH' both the 'run-tests.py' executable directory, and the actual file location direction. diff -r bb67e52362d6 -r 39ee0444e27c tests/run-tests.py --- a/tests/run-tests.py Sat Apr 11 16:55:14 2015 -0400 +++ b/tests/run-tests.py Sat Apr 11 14:44:12 2015 -0400 @@ -1693,6 +1693,11 @@ runtestdir = os.path.abspath(os.path.dirname(__file__)) path = [self._bindir, runtestdir] + os.environ["PATH"].split(os.pathsep) + if os.path.islink(__file__): + # test helper will likely be at the end of the symlink + realfile = os.path.realpath(__file__) + realdir = os.path.abspath(os.path.dirname(realfile)) + path.insert(2, realdir) if self._tmpbindir != self._bindir: path = [self._tmpbindir] + path os.environ["PATH"] = os.pathsep.join(path)