comparison tests/run-tests.py @ 47574:2b2f5cf979c3

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 09 Jul 2021 16:18:41 +0200
parents 75b623801f6a
children 27fb9f32e1a3
comparison
equal deleted inserted replaced
47573:75b623801f6a 47574:2b2f5cf979c3
3021 self._hgtmp = None 3021 self._hgtmp = None
3022 self._installdir = None 3022 self._installdir = None
3023 self._bindir = None 3023 self._bindir = None
3024 self._tmpbindir = None 3024 self._tmpbindir = None
3025 self._pythondir = None 3025 self._pythondir = None
3026 # True if we had to infer the pythondir from --with-hg
3027 self._pythondir_inferred = False
3026 self._coveragefile = None 3028 self._coveragefile = None
3027 self._createdfiles = [] 3029 self._createdfiles = []
3028 self._hgcommand = None 3030 self._hgcommand = None
3029 self._hgpath = None 3031 self._hgpath = None
3030 self._portoffset = 0 3032 self._portoffset = 0
3137 elif re.search(b'/rust/target/[^/]+/hg', normbin): 3139 elif re.search(b'/rust/target/[^/]+/hg', normbin):
3138 self._pythondir = os.path.dirname(self._testdir) 3140 self._pythondir = os.path.dirname(self._testdir)
3139 # Fall back to the legacy behavior. 3141 # Fall back to the legacy behavior.
3140 else: 3142 else:
3141 self._pythondir = self._bindir 3143 self._pythondir = self._bindir
3144 self._pythondir_inferred = True
3142 3145
3143 else: 3146 else:
3144 self._installdir = os.path.join(self._hgtmp, b"install") 3147 self._installdir = os.path.join(self._hgtmp, b"install")
3145 self._bindir = os.path.join(self._installdir, b"bin") 3148 self._bindir = os.path.join(self._installdir, b"bin")
3146 self._hgcommand = b'hg' 3149 self._hgcommand = b'hg'
3738 osenvironb[b'COVERAGE_DIR'] = covdir 3741 osenvironb[b'COVERAGE_DIR'] = covdir
3739 3742
3740 def _checkhglib(self, verb): 3743 def _checkhglib(self, verb):
3741 """Ensure that the 'mercurial' package imported by python is 3744 """Ensure that the 'mercurial' package imported by python is
3742 the one we expect it to be. If not, print a warning to stderr.""" 3745 the one we expect it to be. If not, print a warning to stderr."""
3743 if (self._bindir == self._pythondir) and ( 3746 if self._pythondir_inferred:
3744 self._bindir != self._tmpbindir
3745 ):
3746 # The pythondir has been inferred from --with-hg flag. 3747 # The pythondir has been inferred from --with-hg flag.
3747 # We cannot expect anything sensible here. 3748 # We cannot expect anything sensible here.
3748 return 3749 return
3749 expecthg = os.path.join(self._pythondir, b'mercurial') 3750 expecthg = os.path.join(self._pythondir, b'mercurial')
3750 actualhg = self._gethgpath() 3751 actualhg = self._gethgpath()