run-tests: establish TestRunner.run()
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 09:49:33 -0700
changeset 21366 5047248536c5
parent 21365 10cf9054d941
child 21367 522e3d24a461
run-tests: establish TestRunner.run() (amended by mpm to remove environ cleanup - unrelated change that breaks on Solaris)
tests/run-tests.py
--- a/tests/run-tests.py	Sun Apr 20 09:44:39 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 09:49:33 2014 -0700
@@ -1014,6 +1014,22 @@
         self.abort = [False]
         self._createdfiles = []
 
+    def run(self, tests):
+        """Run the test suite."""
+        return self._run(tests)
+
+    def _run(self, tests):
+        vlog("# Using TESTDIR", self.testdir)
+        vlog("# Using HGTMP", self.hgtmp)
+        vlog("# Using PATH", os.environ["PATH"])
+        vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
+
+        try:
+            return self._runtests(tests) or 0
+        finally:
+            time.sleep(.1)
+            self._cleanup()
+
     def findtests(self, args):
         """Finds possible test files from arguments.
 
@@ -1033,7 +1049,7 @@
                 if os.path.basename(t).startswith('test-')
                     and (t.endswith('.py') or t.endswith('.t'))]
 
-    def runtests(self, tests):
+    def _runtests(self, tests):
         try:
             if self.inst:
                 self.installhg()
@@ -1105,7 +1121,7 @@
 
         return testcls(self, test, count, refpath)
 
-    def cleanup(self):
+    def _cleanup(self):
         """Clean up state from this test invocation."""
 
         if self.options.keep_tmpdir:
@@ -1445,16 +1461,7 @@
 
     runner.coveragefile = os.path.join(runner.testdir, ".coverage")
 
-    vlog("# Using TESTDIR", runner.testdir)
-    vlog("# Using HGTMP", runner.hgtmp)
-    vlog("# Using PATH", os.environ["PATH"])
-    vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
-
-    try:
-        return runner.runtests(tests) or 0
-    finally:
-        time.sleep(.1)
-        runner.cleanup()
+    return runner.run(tests)
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))