##// END OF EJS Templates
run-tests: make some methods of TestRunner internal
Gregory Szorc -
r21378:f7ac3c63 default
parent child Browse files
Show More
@@ -1158,10 +1158,10 b' class TestRunner(object):'
1158 def _runtests(self, tests):
1158 def _runtests(self, tests):
1159 try:
1159 try:
1160 if self.inst:
1160 if self.inst:
1161 self.installhg()
1161 self._installhg()
1162 self.checkhglib("Testing")
1162 self._checkhglib("Testing")
1163 else:
1163 else:
1164 self.usecorrectpython()
1164 self._usecorrectpython()
1165
1165
1166 if self.options.restart:
1166 if self.options.restart:
1167 orig = list(tests)
1167 orig = list(tests)
@@ -1189,16 +1189,16 b' class TestRunner(object):'
1189 print "Warned %s: %s" % s
1189 print "Warned %s: %s" % s
1190 for s in self.results['!']:
1190 for s in self.results['!']:
1191 print "Failed %s: %s" % s
1191 print "Failed %s: %s" % s
1192 self.checkhglib("Tested")
1192 self._checkhglib("Tested")
1193 print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
1193 print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
1194 tested, skipped + ignored, warned, failed)
1194 tested, skipped + ignored, warned, failed)
1195 if self.results['!']:
1195 if self.results['!']:
1196 print 'python hash seed:', os.environ['PYTHONHASHSEED']
1196 print 'python hash seed:', os.environ['PYTHONHASHSEED']
1197 if self.options.time:
1197 if self.options.time:
1198 self.outputtimes()
1198 self._outputtimes()
1199
1199
1200 if self.options.anycoverage:
1200 if self.options.anycoverage:
1201 self.outputcoverage()
1201 self._outputcoverage()
1202 except KeyboardInterrupt:
1202 except KeyboardInterrupt:
1203 failed = True
1203 failed = True
1204 print "\ninterrupted!"
1204 print "\ninterrupted!"
@@ -1208,7 +1208,7 b' class TestRunner(object):'
1208 if warned:
1208 if warned:
1209 return 80
1209 return 80
1210
1210
1211 def gettest(self, test, count):
1211 def _gettest(self, test, count):
1212 """Obtain a Test by looking at its filename.
1212 """Obtain a Test by looking at its filename.
1213
1213
1214 Returns a Test instance. The Test may not be runnable if it doesn't
1214 Returns a Test instance. The Test may not be runnable if it doesn't
@@ -1241,7 +1241,7 b' class TestRunner(object):'
1241 except OSError:
1241 except OSError:
1242 pass
1242 pass
1243
1243
1244 def usecorrectpython(self):
1244 def _usecorrectpython(self):
1245 # Some tests run the Python interpreter. They must use the
1245 # Some tests run the Python interpreter. They must use the
1246 # same interpreter or bad things will happen.
1246 # same interpreter or bad things will happen.
1247 pyexename = sys.platform == 'win32' and 'python.exe' or 'python'
1247 pyexename = sys.platform == 'win32' and 'python.exe' or 'python'
@@ -1275,7 +1275,7 b' class TestRunner(object):'
1275 if not self._findprogram(pyexename):
1275 if not self._findprogram(pyexename):
1276 print "WARNING: Cannot find %s in search path" % pyexename
1276 print "WARNING: Cannot find %s in search path" % pyexename
1277
1277
1278 def installhg(self):
1278 def _installhg(self):
1279 vlog("# Performing temporary installation of HG")
1279 vlog("# Performing temporary installation of HG")
1280 installerrs = os.path.join("tests", "install.err")
1280 installerrs = os.path.join("tests", "install.err")
1281 compiler = ''
1281 compiler = ''
@@ -1320,7 +1320,7 b' class TestRunner(object):'
1320 sys.exit(1)
1320 sys.exit(1)
1321 os.chdir(self.testdir)
1321 os.chdir(self.testdir)
1322
1322
1323 self.usecorrectpython()
1323 self._usecorrectpython()
1324
1324
1325 if self.options.py3k_warnings and not self.options.anycoverage:
1325 if self.options.py3k_warnings and not self.options.anycoverage:
1326 vlog("# Updating hg command to enable Py3k Warnings switch")
1326 vlog("# Updating hg command to enable Py3k Warnings switch")
@@ -1360,7 +1360,7 b' class TestRunner(object):'
1360 fn = os.path.join(self.inst, '..', '.coverage')
1360 fn = os.path.join(self.inst, '..', '.coverage')
1361 os.environ['COVERAGE_FILE'] = fn
1361 os.environ['COVERAGE_FILE'] = fn
1362
1362
1363 def checkhglib(self, verb):
1363 def _checkhglib(self, verb):
1364 """Ensure that the 'mercurial' package imported by python is
1364 """Ensure that the 'mercurial' package imported by python is
1365 the one we expect it to be. If not, print a warning to stderr."""
1365 the one we expect it to be. If not, print a warning to stderr."""
1366 expecthg = os.path.join(self.pythondir, 'mercurial')
1366 expecthg = os.path.join(self.pythondir, 'mercurial')
@@ -1370,7 +1370,7 b' class TestRunner(object):'
1370 ' (expected %s)\n'
1370 ' (expected %s)\n'
1371 % (verb, actualhg, expecthg))
1371 % (verb, actualhg, expecthg))
1372
1372
1373 def outputtimes(self):
1373 def _outputtimes(self):
1374 vlog('# Producing time report')
1374 vlog('# Producing time report')
1375 self.times.sort(key=lambda t: (t[1], t[0]), reverse=True)
1375 self.times.sort(key=lambda t: (t[1], t[0]), reverse=True)
1376 cols = '%7.3f %s'
1376 cols = '%7.3f %s'
@@ -1378,7 +1378,7 b' class TestRunner(object):'
1378 for test, timetaken in self.times:
1378 for test, timetaken in self.times:
1379 print cols % (timetaken, test)
1379 print cols % (timetaken, test)
1380
1380
1381 def outputcoverage(self):
1381 def _outputcoverage(self):
1382 vlog('# Producing coverage report')
1382 vlog('# Producing coverage report')
1383 os.chdir(self.pythondir)
1383 os.chdir(self.pythondir)
1384
1384
@@ -1409,7 +1409,7 b' class TestRunner(object):'
1409
1409
1410 def job(test, count):
1410 def job(test, count):
1411 try:
1411 try:
1412 t = self.gettest(test, count)
1412 t = self._gettest(test, count)
1413 done.put(t.run())
1413 done.put(t.run())
1414 t.cleanup()
1414 t.cleanup()
1415 except KeyboardInterrupt:
1415 except KeyboardInterrupt:
General Comments 0
You need to be logged in to leave comments. Login now