changeset 21354:29629ef43d39

run-tests: move checkhglib into TestRunner
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 19 Apr 2014 23:44:56 -0700
parents a42a5195a182
children d83f4e94512a
files tests/run-tests.py
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sat Apr 19 23:43:00 2014 -0700
+++ b/tests/run-tests.py	Sat Apr 19 23:44:56 2014 -0700
@@ -1041,16 +1041,6 @@
         pipe.close()
     return _hgpath
 
-def _checkhglib(runner, verb):
-    """Ensure that the 'mercurial' package imported by python is
-    the one we expect it to be.  If not, print a warning to stderr."""
-    expecthg = os.path.join(runner.pythondir, 'mercurial')
-    actualhg = _gethgpath()
-    if os.path.abspath(actualhg) != os.path.abspath(expecthg):
-        sys.stderr.write('warning: %s with unexpected mercurial lib: %s\n'
-                         '         (expected %s)\n'
-                         % (verb, actualhg, expecthg))
-
 results = {'.':[], '!':[], '~': [], 's':[], 'i':[]}
 times = []
 iolock = threading.Lock()
@@ -1100,7 +1090,7 @@
     try:
         if runner.inst:
             runner.installhg()
-            _checkhglib(runner, "Testing")
+            runner.checkhglib("Testing")
         else:
             runner.usecorrectpython()
 
@@ -1130,7 +1120,7 @@
             print "Warned %s: %s" % s
         for s in results['!']:
             print "Failed %s: %s" % s
-        _checkhglib(runner, "Tested")
+        runner.checkhglib("Tested")
         print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
             tested, skipped + ignored, warned, failed)
         if results['!']:
@@ -1301,6 +1291,16 @@
             fn = os.path.join(self.inst, '..', '.coverage')
             os.environ['COVERAGE_FILE'] = fn
 
+    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."""
+        expecthg = os.path.join(self.pythondir, 'mercurial')
+        actualhg = _gethgpath()
+        if os.path.abspath(actualhg) != os.path.abspath(expecthg):
+            sys.stderr.write('warning: %s with unexpected mercurial lib: %s\n'
+                             '         (expected %s)\n'
+                             % (verb, actualhg, expecthg))
+
 def main(args, parser=None):
     runner = TestRunner()