changeset 52698:6ed726d1cd16

hghave: byteify the `regexp` arg to `matchoutput()` This started failing in CI because a str was passed. All other callers already pass bytes, and it's not clear why this started failing with a MR to use `setuptools-scm` to derive the version when building. Clearly the `if checks["hg09"][0]()` prior to these usages were working before, and that's how it was overlooked. But that check apparently continued to work for me locally in both Linux and Windows, as I can only hit this issue in CI.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 12 Jan 2025 19:55:06 -0500
parents 30510238284e
children e1c5d823287b
files tests/hghave.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Fri Oct 25 11:15:29 2024 +0200
+++ b/tests/hghave.py	Sun Jan 12 19:55:06 2025 -0500
@@ -141,7 +141,7 @@
     return env
 
 
-def matchoutput(cmd, regexp, ignorestatus=False):
+def matchoutput(cmd, regexp: bytes, ignorestatus=False):
     """Return the match object if cmd executes successfully and its output
     is matched by the supplied regular expression.
     """
@@ -386,21 +386,23 @@
 def has_hg08():
     if checks["hg09"][0]():
         return True
-    return matchoutput('hg help annotate 2>&1', '--date')
+    return matchoutput('hg help annotate 2>&1', b'--date')
 
 
 @check("hg07", "Mercurial >= 0.7")
 def has_hg07():
     if checks["hg08"][0]():
         return True
-    return matchoutput('hg --version --quiet 2>&1', 'Mercurial Distributed SCM')
+    return matchoutput(
+        'hg --version --quiet 2>&1', b'Mercurial Distributed SCM'
+    )
 
 
 @check("hg06", "Mercurial >= 0.6")
 def has_hg06():
     if checks["hg07"][0]():
         return True
-    return matchoutput('hg --version --quiet 2>&1', 'Mercurial version')
+    return matchoutput('hg --version --quiet 2>&1', b'Mercurial version')
 
 
 @check("gettext", "GNU Gettext (msgfmt)")