##// END OF EJS Templates
run-tests: move cleanup() into TestRunner
Gregory Szorc -
r21350:dfcef61f default
parent child Browse files
Show More
@@ -388,18 +388,6 b' def killdaemons(pidfile):'
388 return killmod.killdaemons(pidfile, tryhard=False, remove=True,
388 return killmod.killdaemons(pidfile, tryhard=False, remove=True,
389 logfn=vlog)
389 logfn=vlog)
390
390
391 def cleanup(runner):
392 if runner.options.keep_tmpdir:
393 return
394
395 vlog("# Cleaning up HGTMP", runner.hgtmp)
396 shutil.rmtree(runner.hgtmp, True)
397 for f in createdfiles:
398 try:
399 os.remove(f)
400 except OSError:
401 pass
402
403 def usecorrectpython(runner):
391 def usecorrectpython(runner):
404 # some tests run python interpreter. they must use same
392 # some tests run python interpreter. they must use same
405 # interpreter we use or bad things will happen.
393 # interpreter we use or bad things will happen.
@@ -1298,6 +1286,20 b' class TestRunner(object):'
1298 self.pythondir = None
1286 self.pythondir = None
1299 self.coveragefile = None
1287 self.coveragefile = None
1300
1288
1289 def cleanup(self):
1290 """Clean up state from this test invocation."""
1291
1292 if self.options.keep_tmpdir:
1293 return
1294
1295 vlog("# Cleaning up HGTMP", self.hgtmp)
1296 shutil.rmtree(self.hgtmp, True)
1297 for f in createdfiles:
1298 try:
1299 os.remove(f)
1300 except OSError:
1301 pass
1302
1301 def main(args, parser=None):
1303 def main(args, parser=None):
1302 runner = TestRunner()
1304 runner = TestRunner()
1303
1305
@@ -1424,7 +1426,7 b' def main(args, parser=None):'
1424 return runtests(runner, tests) or 0
1426 return runtests(runner, tests) or 0
1425 finally:
1427 finally:
1426 time.sleep(.1)
1428 time.sleep(.1)
1427 cleanup(runner)
1429 runner.cleanup()
1428
1430
1429 if __name__ == '__main__':
1431 if __name__ == '__main__':
1430 sys.exit(main(sys.argv[1:]))
1432 sys.exit(main(sys.argv[1:]))
General Comments 0
You need to be logged in to leave comments. Login now