testing: add hghave tests for additional Mercurial versions
authorGregory Szorc <gps@mozilla.com>
Sat, 17 Jan 2015 16:10:38 -0800
changeset 360131 4c9a624b63cae6699f1babdfd74fe759463cf2dd
parent 360130 701f590cb6ca3b226621e571b7bfa47cfdda19aa
child 360132 b660b4a7dea055ba123f1c1c2e84e5e5a9aaece5
push id16998
push userrwood@mozilla.com
push dateMon, 02 May 2016 19:42:03 +0000
testing: add hghave tests for additional Mercurial versions
testing/hghave.py
--- a/testing/hghave.py
+++ b/testing/hghave.py
@@ -37,23 +37,34 @@ def has_docker():
 
     url, tls = params_from_env(os.environ)
 
     tf = tempfile.NamedTemporaryFile()
     tf.close()
     d = Docker(tf.name, url, tls=tls)
     return d.is_alive()
 
-@check('hg30+', 'Running with Mercurial 3.0+')
-def has_hg_30_plus():
+def hgversion():
     v = os.environ['HGVERSION']
     v = v.split('+')[0]
-    vers = [int(i) for i in v.split('.')]
+    return tuple(int(i) for i in v.split('.'))
+
+@check('hg30+', 'Running with Mercurial 3.0+')
+def has_hg_30_plus():
+    return hgversion()[0] >= 3
 
-    return vers[0] >= 3
+@check('hg31+', 'Running with Mercurial 3.1+')
+def has_hg_31_plus():
+    v = tuple(hgversion()[0:2])
+    return v >= (3, 1)
+
+@check('hg32+', 'Running with Mercurial 3.2+')
+def has_hg32_plus():
+    v = tuple(hgversion()[0:2])
+    return v >= (3, 2)
 
 # Now we reimplement the command line syntax of the CLI hghave script.
 failures = 0
 
 def error(msg):
     global failures
     sys.stderr.write('%s\n' % msg)
     failures += 1