##// END OF EJS Templates
run-tests: establish a class to hold testing state
Gregory Szorc -
r21340:fda36de1 default
parent child Browse files
Show More
@@ -1182,7 +1182,7 b' times = []'
1182 iolock = threading.Lock()
1182 iolock = threading.Lock()
1183 abort = False
1183 abort = False
1184
1184
1185 def scheduletests(options, tests):
1185 def scheduletests(runner, options, tests):
1186 jobs = options.jobs
1186 jobs = options.jobs
1187 done = queue.Queue()
1187 done = queue.Queue()
1188 running = 0
1188 running = 0
@@ -1222,7 +1222,7 b' def scheduletests(options, tests):'
1222 except KeyboardInterrupt:
1222 except KeyboardInterrupt:
1223 abort = True
1223 abort = True
1224
1224
1225 def runtests(options, tests):
1225 def runtests(runner, options, tests):
1226 try:
1226 try:
1227 if INST:
1227 if INST:
1228 installhg(options)
1228 installhg(options)
@@ -1240,7 +1240,7 b' def runtests(options, tests):'
1240 print "running all tests"
1240 print "running all tests"
1241 tests = orig
1241 tests = orig
1242
1242
1243 scheduletests(options, tests)
1243 scheduletests(runner, options, tests)
1244
1244
1245 failed = len(results['!'])
1245 failed = len(results['!'])
1246 warned = len(results['~'])
1246 warned = len(results['~'])
@@ -1278,7 +1278,15 b' def runtests(options, tests):'
1278 testtypes = [('.py', PythonTest, '.out'),
1278 testtypes = [('.py', PythonTest, '.out'),
1279 ('.t', TTest, '')]
1279 ('.t', TTest, '')]
1280
1280
1281 class TestRunner(object):
1282 """Holds context for executing tests.
1283
1284 Tests rely on a lot of state. This object holds it for them.
1285 """
1286
1281 def main(args, parser=None):
1287 def main(args, parser=None):
1288 runner = TestRunner()
1289
1282 parser = parser or getparser()
1290 parser = parser or getparser()
1283 (options, args) = parseargs(args, parser)
1291 (options, args) = parseargs(args, parser)
1284 os.umask(022)
1292 os.umask(022)
@@ -1397,7 +1405,7 b' def main(args, parser=None):'
1397 vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
1405 vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
1398
1406
1399 try:
1407 try:
1400 return runtests(options, tests) or 0
1408 return runtests(runner, options, tests) or 0
1401 finally:
1409 finally:
1402 time.sleep(.1)
1410 time.sleep(.1)
1403 cleanup(options)
1411 cleanup(options)
General Comments 0
You need to be logged in to leave comments. Login now