[PATCH 1 of 3] hghave: add "chg" flag to skip tests that can't be compatible with chg

Yuya Nishihara yuya at tcha.org
Fri Apr 8 15:23:57 UTC 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1458510956 25200
#      Sun Mar 20 14:55:56 2016 -0700
# Node ID 346e013b362fcbb5146c6167cea35bdb14c848ec
# Parent  c5565fc8848dd084d104ca40c33d1acdfcff8bc6
hghave: add "chg" flag to skip tests that can't be compatible with chg

Several tests fail with chg for several reasons such as loaded chgserver
extension, running uisetup() per server instead of per runcommand, etc.
Since these tests can't/shouldn't be changed to be chg friendly, we need
a flag to skip them.

This patch explicitly drops CHGHG environment if chg isn't involved. This
way, hghave can just check if CHGHG exists.

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -124,6 +124,10 @@ def has_bzr_range(v):
     except ImportError:
         return False
 
+ at check("chg", "running with chg")
+def has_chg():
+    return 'CHGHG' in os.environ
+
 @check("cvs", "cvs client/server")
 def has_cvs():
     re = r'Concurrent Versions System.*?server'
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2064,6 +2064,8 @@ class TestRunner(object):
         chgbindir = self._bindir
         if self.options.chg or self.options.with_chg:
             osenvironb[b'CHGHG'] = os.path.join(self._bindir, self._hgcommand)
+        else:
+            osenvironb.pop(b'CHGHG', None)  # drop flag for hghave
         if self.options.chg:
             self._hgcommand = b'chg'
         elif self.options.with_chg:


More information about the Mercurial-devel mailing list