run-tests: explicitly track that `pythondir` was inferred
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 09 Jul 2021 16:18:41 +0200
changeset 47574 2b2f5cf979c3
parent 47573 75b623801f6a
child 47575 27fb9f32e1a3
run-tests: explicitly track that `pythondir` was inferred If we want to know that something happened, we should simply track that this things happened. This will be useful to start using `tmpbindir` more in a different form. Differential Revision: https://phab.mercurial-scm.org/D11043
tests/run-tests.py
--- a/tests/run-tests.py	Fri Jul 09 15:39:43 2021 +0200
+++ b/tests/run-tests.py	Fri Jul 09 16:18:41 2021 +0200
@@ -3023,6 +3023,8 @@
         self._bindir = None
         self._tmpbindir = None
         self._pythondir = None
+        # True if we had to infer the pythondir from --with-hg
+        self._pythondir_inferred = False
         self._coveragefile = None
         self._createdfiles = []
         self._hgcommand = None
@@ -3139,6 +3141,7 @@
             # Fall back to the legacy behavior.
             else:
                 self._pythondir = self._bindir
+            self._pythondir_inferred = True
 
         else:
             self._installdir = os.path.join(self._hgtmp, b"install")
@@ -3740,9 +3743,7 @@
     def _checkhglib(self, verb):
         """Ensure that the 'mercurial' package imported by python is
         the one we expect it to be.  If not, print a warning to stderr."""
-        if (self._bindir == self._pythondir) and (
-            self._bindir != self._tmpbindir
-        ):
+        if self._pythondir_inferred:
             # The pythondir has been inferred from --with-hg flag.
             # We cannot expect anything sensible here.
             return