run-tests: make some methods of TestRunner internal
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 10:11:46 -0700
changeset 21378 f7ac3c63d844
parent 21377 71081f7f9e52
child 21379 ab1a95270a50
run-tests: make some methods of TestRunner internal
tests/run-tests.py
--- a/tests/run-tests.py	Sun Apr 20 10:09:23 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 10:11:46 2014 -0700
@@ -1158,10 +1158,10 @@
     def _runtests(self, tests):
         try:
             if self.inst:
-                self.installhg()
-                self.checkhglib("Testing")
+                self._installhg()
+                self._checkhglib("Testing")
             else:
-                self.usecorrectpython()
+                self._usecorrectpython()
 
             if self.options.restart:
                 orig = list(tests)
@@ -1189,16 +1189,16 @@
                 print "Warned %s: %s" % s
             for s in self.results['!']:
                 print "Failed %s: %s" % s
-            self.checkhglib("Tested")
+            self._checkhglib("Tested")
             print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
                 tested, skipped + ignored, warned, failed)
             if self.results['!']:
                 print 'python hash seed:', os.environ['PYTHONHASHSEED']
             if self.options.time:
-                self.outputtimes()
+                self._outputtimes()
 
             if self.options.anycoverage:
-                self.outputcoverage()
+                self._outputcoverage()
         except KeyboardInterrupt:
             failed = True
             print "\ninterrupted!"
@@ -1208,7 +1208,7 @@
         if warned:
             return 80
 
-    def gettest(self, test, count):
+    def _gettest(self, test, count):
         """Obtain a Test by looking at its filename.
 
         Returns a Test instance. The Test may not be runnable if it doesn't
@@ -1241,7 +1241,7 @@
             except OSError:
                 pass
 
-    def usecorrectpython(self):
+    def _usecorrectpython(self):
         # Some tests run the Python interpreter. They must use the
         # same interpreter or bad things will happen.
         pyexename = sys.platform == 'win32' and 'python.exe' or 'python'
@@ -1275,7 +1275,7 @@
             if not self._findprogram(pyexename):
                 print "WARNING: Cannot find %s in search path" % pyexename
 
-    def installhg(self):
+    def _installhg(self):
         vlog("# Performing temporary installation of HG")
         installerrs = os.path.join("tests", "install.err")
         compiler = ''
@@ -1320,7 +1320,7 @@
             sys.exit(1)
         os.chdir(self.testdir)
 
-        self.usecorrectpython()
+        self._usecorrectpython()
 
         if self.options.py3k_warnings and not self.options.anycoverage:
             vlog("# Updating hg command to enable Py3k Warnings switch")
@@ -1360,7 +1360,7 @@
             fn = os.path.join(self.inst, '..', '.coverage')
             os.environ['COVERAGE_FILE'] = fn
 
-    def checkhglib(self, verb):
+    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')
@@ -1370,7 +1370,7 @@
                              '         (expected %s)\n'
                              % (verb, actualhg, expecthg))
 
-    def outputtimes(self):
+    def _outputtimes(self):
         vlog('# Producing time report')
         self.times.sort(key=lambda t: (t[1], t[0]), reverse=True)
         cols = '%7.3f   %s'
@@ -1378,7 +1378,7 @@
         for test, timetaken in self.times:
             print cols % (timetaken, test)
 
-    def outputcoverage(self):
+    def _outputcoverage(self):
         vlog('# Producing coverage report')
         os.chdir(self.pythondir)
 
@@ -1409,7 +1409,7 @@
 
         def job(test, count):
             try:
-                t = self.gettest(test, count)
+                t = self._gettest(test, count)
                 done.put(t.run())
                 t.cleanup()
             except KeyboardInterrupt: