Mercurial > hg
changeset 21350:dfcef61f5bd4
run-tests: move cleanup() into TestRunner
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 19 Apr 2014 23:35:27 -0700 |
parents | 2d767c7c3df0 |
children | fe5647506565 |
files | tests/run-tests.py |
diffstat | 1 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Sat Apr 19 23:33:44 2014 -0700 +++ b/tests/run-tests.py Sat Apr 19 23:35:27 2014 -0700 @@ -388,18 +388,6 @@ return killmod.killdaemons(pidfile, tryhard=False, remove=True, logfn=vlog) -def cleanup(runner): - if runner.options.keep_tmpdir: - return - - vlog("# Cleaning up HGTMP", runner.hgtmp) - shutil.rmtree(runner.hgtmp, True) - for f in createdfiles: - try: - os.remove(f) - except OSError: - pass - def usecorrectpython(runner): # some tests run python interpreter. they must use same # interpreter we use or bad things will happen. @@ -1298,6 +1286,20 @@ self.pythondir = None self.coveragefile = None + def cleanup(self): + """Clean up state from this test invocation.""" + + if self.options.keep_tmpdir: + return + + vlog("# Cleaning up HGTMP", self.hgtmp) + shutil.rmtree(self.hgtmp, True) + for f in createdfiles: + try: + os.remove(f) + except OSError: + pass + def main(args, parser=None): runner = TestRunner() @@ -1424,7 +1426,7 @@ return runtests(runner, tests) or 0 finally: time.sleep(.1) - cleanup(runner) + runner.cleanup() if __name__ == '__main__': sys.exit(main(sys.argv[1:]))