Mercurial > hg
comparison tests/run-tests.py @ 21359:7982475da46a
run-tests: move results global into TestRunner
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 00:03:32 -0700 |
parents | fcc2e02e91a2 |
children | becce297ae0c |
comparison
equal
deleted
inserted
replaced
21358:fcc2e02e91a2 | 21359:7982475da46a |
---|---|
989 _hgpath = pipe.read().strip() | 989 _hgpath = pipe.read().strip() |
990 finally: | 990 finally: |
991 pipe.close() | 991 pipe.close() |
992 return _hgpath | 992 return _hgpath |
993 | 993 |
994 results = {'.':[], '!':[], '~': [], 's':[], 'i':[]} | |
995 iolock = threading.Lock() | 994 iolock = threading.Lock() |
996 abort = False | 995 abort = False |
997 | 996 |
998 def scheduletests(runner, tests): | 997 def scheduletests(runner, tests): |
999 jobs = runner.options.jobs | 998 jobs = runner.options.jobs |
1016 try: | 1015 try: |
1017 while tests or running: | 1016 while tests or running: |
1018 if not done.empty() or running == jobs or not tests: | 1017 if not done.empty() or running == jobs or not tests: |
1019 try: | 1018 try: |
1020 code, test, msg = done.get(True, 1) | 1019 code, test, msg = done.get(True, 1) |
1021 results[code].append((test, msg)) | 1020 runner.results[code].append((test, msg)) |
1022 if runner.options.first and code not in '.si': | 1021 if runner.options.first and code not in '.si': |
1023 break | 1022 break |
1024 except queue.Empty: | 1023 except queue.Empty: |
1025 continue | 1024 continue |
1026 running -= 1 | 1025 running -= 1 |
1053 print "running all tests" | 1052 print "running all tests" |
1054 tests = orig | 1053 tests = orig |
1055 | 1054 |
1056 scheduletests(runner, tests) | 1055 scheduletests(runner, tests) |
1057 | 1056 |
1058 failed = len(results['!']) | 1057 failed = len(runner.results['!']) |
1059 warned = len(results['~']) | 1058 warned = len(runner.results['~']) |
1060 tested = len(results['.']) + failed + warned | 1059 tested = len(runner.results['.']) + failed + warned |
1061 skipped = len(results['s']) | 1060 skipped = len(runner.results['s']) |
1062 ignored = len(results['i']) | 1061 ignored = len(runner.results['i']) |
1063 | 1062 |
1064 print | 1063 print |
1065 if not runner.options.noskips: | 1064 if not runner.options.noskips: |
1066 for s in results['s']: | 1065 for s in runner.results['s']: |
1067 print "Skipped %s: %s" % s | 1066 print "Skipped %s: %s" % s |
1068 for s in results['~']: | 1067 for s in runner.results['~']: |
1069 print "Warned %s: %s" % s | 1068 print "Warned %s: %s" % s |
1070 for s in results['!']: | 1069 for s in runner.results['!']: |
1071 print "Failed %s: %s" % s | 1070 print "Failed %s: %s" % s |
1072 runner.checkhglib("Tested") | 1071 runner.checkhglib("Tested") |
1073 print "# Ran %d tests, %d skipped, %d warned, %d failed." % ( | 1072 print "# Ran %d tests, %d skipped, %d warned, %d failed." % ( |
1074 tested, skipped + ignored, warned, failed) | 1073 tested, skipped + ignored, warned, failed) |
1075 if results['!']: | 1074 if runner.results['!']: |
1076 print 'python hash seed:', os.environ['PYTHONHASHSEED'] | 1075 print 'python hash seed:', os.environ['PYTHONHASHSEED'] |
1077 if runner.options.time: | 1076 if runner.options.time: |
1078 runner.outputtimes() | 1077 runner.outputtimes() |
1079 | 1078 |
1080 if runner.options.anycoverage: | 1079 if runner.options.anycoverage: |
1107 self.bindir = None | 1106 self.bindir = None |
1108 self.tmpbinddir = None | 1107 self.tmpbinddir = None |
1109 self.pythondir = None | 1108 self.pythondir = None |
1110 self.coveragefile = None | 1109 self.coveragefile = None |
1111 self.times = [] # Holds execution times of tests. | 1110 self.times = [] # Holds execution times of tests. |
1111 self.results = { | |
1112 '.': [], | |
1113 '!': [], | |
1114 '~': [], | |
1115 's': [], | |
1116 'i': [], | |
1117 } | |
1112 self._createdfiles = [] | 1118 self._createdfiles = [] |
1113 | 1119 |
1114 def gettest(self, test, count): | 1120 def gettest(self, test, count): |
1115 """Obtain a Test by looking at its filename. | 1121 """Obtain a Test by looking at its filename. |
1116 | 1122 |