Mercurial > hg
changeset 13989:55ba68a4dd28
run-tests: move existence/name format check into runone
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 21 Apr 2011 18:38:30 -0500 |
parents | 994ad067ac6e |
children | ddf488bfbdbd |
files | tests/run-tests.py |
diffstat | 1 files changed, 16 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Thu Apr 21 18:19:45 2011 -0500 +++ b/tests/run-tests.py Thu Apr 21 18:38:30 2011 -0500 @@ -639,6 +639,8 @@ True -> passed False -> failed''' + testpath = os.path.join(TESTDIR, test) + def skip(msg): if not options.verbose: skips.append((test, msg)) @@ -660,6 +662,15 @@ return fails.append((test, msg)) + if (test.startswith("test-") and '~' not in test and + ('.' not in test or test.endswith('.py') or + test.endswith('.bat') or test.endswith('.t'))): + if not os.path.exists(test): + skip("doesn't exist") + return None + else: + return None # not a supported test, don't record + vlog("# Test", test) # create a fresh hgrc @@ -678,7 +689,6 @@ hgrc.write('appendpid=True\n') hgrc.close() - testpath = os.path.join(TESTDIR, test) ref = os.path.join(TESTDIR, test+".out") err = os.path.join(TESTDIR, test+".err") if os.path.exists(err): @@ -944,7 +954,10 @@ continue if options.keywords: - fp = open(test) + try: + fp = open(test) + except IOError: + continue t = fp.read().lower() + test.lower() fp.close() for k in options.keywords.lower().split(): @@ -1001,22 +1014,7 @@ args = os.listdir(".") args.sort() - tests = [] - skipped = [] - for test in args: - if (test.startswith("test-") and '~' not in test and - ('.' not in test or test.endswith('.py') or - test.endswith('.bat') or test.endswith('.t'))): - if not os.path.exists(test): - skipped.append(test) - else: - tests.append(test) - if not tests: - for test in skipped: - print 'Skipped %s: does not exist' % test - print "# Ran 0 tests, %d skipped, 0 failed." % len(skipped) - return - tests = tests + skipped + tests = args # Reset some environment variables to well-known values so that # the tests produce repeatable output.