##// END OF EJS Templates
run-tests: move existence/name format check into runone
Matt Mackall -
r13989:55ba68a4 default
parent child Browse files
Show More
@@ -639,6 +639,8 b' def runone(options, test, skips, fails):'
639 True -> passed
639 True -> passed
640 False -> failed'''
640 False -> failed'''
641
641
642 testpath = os.path.join(TESTDIR, test)
643
642 def skip(msg):
644 def skip(msg):
643 if not options.verbose:
645 if not options.verbose:
644 skips.append((test, msg))
646 skips.append((test, msg))
@@ -660,6 +662,15 b' def runone(options, test, skips, fails):'
660 return
662 return
661 fails.append((test, msg))
663 fails.append((test, msg))
662
664
665 if (test.startswith("test-") and '~' not in test and
666 ('.' not in test or test.endswith('.py') or
667 test.endswith('.bat') or test.endswith('.t'))):
668 if not os.path.exists(test):
669 skip("doesn't exist")
670 return None
671 else:
672 return None # not a supported test, don't record
673
663 vlog("# Test", test)
674 vlog("# Test", test)
664
675
665 # create a fresh hgrc
676 # create a fresh hgrc
@@ -678,7 +689,6 b' def runone(options, test, skips, fails):'
678 hgrc.write('appendpid=True\n')
689 hgrc.write('appendpid=True\n')
679 hgrc.close()
690 hgrc.close()
680
691
681 testpath = os.path.join(TESTDIR, test)
682 ref = os.path.join(TESTDIR, test+".out")
692 ref = os.path.join(TESTDIR, test+".out")
683 err = os.path.join(TESTDIR, test+".err")
693 err = os.path.join(TESTDIR, test+".err")
684 if os.path.exists(err):
694 if os.path.exists(err):
@@ -944,7 +954,10 b' def runtests(options, tests):'
944 continue
954 continue
945
955
946 if options.keywords:
956 if options.keywords:
947 fp = open(test)
957 try:
958 fp = open(test)
959 except IOError:
960 continue
948 t = fp.read().lower() + test.lower()
961 t = fp.read().lower() + test.lower()
949 fp.close()
962 fp.close()
950 for k in options.keywords.lower().split():
963 for k in options.keywords.lower().split():
@@ -1001,22 +1014,7 b' def main():'
1001 args = os.listdir(".")
1014 args = os.listdir(".")
1002 args.sort()
1015 args.sort()
1003
1016
1004 tests = []
1017 tests = args
1005 skipped = []
1006 for test in args:
1007 if (test.startswith("test-") and '~' not in test and
1008 ('.' not in test or test.endswith('.py') or
1009 test.endswith('.bat') or test.endswith('.t'))):
1010 if not os.path.exists(test):
1011 skipped.append(test)
1012 else:
1013 tests.append(test)
1014 if not tests:
1015 for test in skipped:
1016 print 'Skipped %s: does not exist' % test
1017 print "# Ran 0 tests, %d skipped, 0 failed." % len(skipped)
1018 return
1019 tests = tests + skipped
1020
1018
1021 # Reset some environment variables to well-known values so that
1019 # Reset some environment variables to well-known values so that
1022 # the tests produce repeatable output.
1020 # the tests produce repeatable output.
General Comments 0
You need to be logged in to leave comments. Login now