run-tests: fix conditional when tests are run outside of `tests` stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 10 Mar 2020 16:47:02 +0100
branchstable
changeset 44471 fb7da4759a18
parent 44451 9803b374389a
child 44472 b7760c2d33de
run-tests: fix conditional when tests are run outside of `tests` The logic to find `hghave` was using `__file__` but… non absolute path in `__file__` gets wrong as soon as we change directory (thanks python… you are being helpful). The rest of the `run-tests.py` code already deal with this fine. We simply reuse the `RUNTESTDIR` variable to fix it.
tests/run-tests.py
--- a/tests/run-tests.py	Mon Mar 09 01:11:59 2020 +0100
+++ b/tests/run-tests.py	Tue Mar 10 16:47:02 2020 +0100
@@ -1626,7 +1626,7 @@
             return self._have.get(allreqs)
 
         # TODO do something smarter when all other uses of hghave are gone.
-        runtestdir = os.path.abspath(os.path.dirname(_bytespath(__file__)))
+        runtestdir = osenvironb[b'RUNTESTDIR']
         tdir = runtestdir.replace(b'\\', b'/')
         proc = Popen4(
             b'%s -c "%s/hghave %s"' % (self._shell, tdir, allreqs),