Show More
@@ -137,8 +137,6 b' def parseargs():' | |||
|
137 | 137 | help="always run tests listed in the specified whitelist file") |
|
138 | 138 | parser.add_option("-C", "--annotate", action="store_true", |
|
139 | 139 | help="output files annotated with coverage") |
|
140 | parser.add_option("--child", type="int", | |
|
141 | help="run as child process, summary to given fd") | |
|
142 | 140 | parser.add_option("-c", "--cover", action="store_true", |
|
143 | 141 | help="print a test coverage report") |
|
144 | 142 | parser.add_option("-d", "--debug", action="store_true", |
@@ -242,10 +240,7 b' def parseargs():' | |||
|
242 | 240 | |
|
243 | 241 | global verbose |
|
244 | 242 | if options.verbose: |
|
245 | if options.jobs > 1 or options.child is not None: | |
|
246 | verbose = "[%d]" % os.getpid() | |
|
247 | else: | |
|
248 | verbose = '' | |
|
243 | verbose = '' | |
|
249 | 244 | |
|
250 | 245 | if options.tmpdir: |
|
251 | 246 | options.tmpdir = os.path.expanduser(options.tmpdir) |
@@ -272,8 +267,7 b' def parseargs():' | |||
|
272 | 267 | if options.blacklist: |
|
273 | 268 | options.blacklist = parselistfiles(options.blacklist, 'blacklist') |
|
274 | 269 | if options.whitelist: |
|
275 |
options.whitelisted = parselistfiles(options.whitelist, 'whitelist' |
|
|
276 | warn=options.child is None) | |
|
270 | options.whitelisted = parselistfiles(options.whitelist, 'whitelist') | |
|
277 | 271 | else: |
|
278 | 272 | options.whitelisted = {} |
|
279 | 273 | |
@@ -568,9 +562,6 b' def outputcoverage(options):' | |||
|
568 | 562 | vlog('# Running: %s' % cmd) |
|
569 | 563 | os.system(cmd) |
|
570 | 564 | |
|
571 | if options.child: | |
|
572 | return | |
|
573 | ||
|
574 | 565 | covrun('-c') |
|
575 | 566 | omit = ','.join(os.path.join(x, '*') for x in [BINDIR, TESTDIR]) |
|
576 | 567 | covrun('-i', '-r', '"--omit=%s"' % omit) # report |
@@ -1133,30 +1124,22 b' def runtests(options, tests):' | |||
|
1133 | 1124 | skipped = len(results['s']) |
|
1134 | 1125 | ignored = len(results['i']) |
|
1135 | 1126 | |
|
1136 | if options.child: | |
|
1137 | fp = os.fdopen(options.child, 'wb') | |
|
1138 | pickle.dump(results, fp, pickle.HIGHEST_PROTOCOL) | |
|
1139 | if options.time: | |
|
1140 | pickle.dump(times, fp, pickle.HIGHEST_PROTOCOL) | |
|
1141 | fp.close() | |
|
1142 | else: | |
|
1143 | ||
|
1144 | for s in results['s']: | |
|
1145 | print "Skipped %s: %s" % s | |
|
1146 | for s in results['!']: | |
|
1147 | print "Failed %s: %s" % s | |
|
1148 | _checkhglib("Tested") | |
|
1149 | print "# Ran %d tests, %d skipped, %d failed." % ( | |
|
1150 | tested, skipped + ignored, failed) | |
|
1151 | if options.time: | |
|
1152 | outputtimes(options) | |
|
1127 | ||
|
1128 | for s in results['s']: | |
|
1129 | print "Skipped %s: %s" % s | |
|
1130 | for s in results['!']: | |
|
1131 | print "Failed %s: %s" % s | |
|
1132 | _checkhglib("Tested") | |
|
1133 | print "# Ran %d tests, %d skipped, %d failed." % ( | |
|
1134 | tested, skipped + ignored, failed) | |
|
1135 | if options.time: | |
|
1136 | outputtimes(options) | |
|
1153 | 1137 | |
|
1154 | 1138 | if options.anycoverage: |
|
1155 | 1139 | outputcoverage(options) |
|
1156 | 1140 | except KeyboardInterrupt: |
|
1157 | 1141 | failed = True |
|
1158 | if not options.child: | |
|
1159 | print "\ninterrupted!" | |
|
1142 | print "\ninterrupted!" | |
|
1160 | 1143 | |
|
1161 | 1144 | if failed: |
|
1162 | 1145 | sys.exit(1) |
@@ -1166,15 +1149,14 b" testtypes = [('.py', pytest, '.out')," | |||
|
1166 | 1149 | |
|
1167 | 1150 | def main(): |
|
1168 | 1151 | (options, args) = parseargs() |
|
1169 | if not options.child: | |
|
1170 | os.umask(022) | |
|
1152 | os.umask(022) | |
|
1171 | 1153 | |
|
1172 |
|
|
|
1154 | checktools() | |
|
1173 | 1155 | |
|
1174 |
|
|
|
1175 |
|
|
|
1176 |
|
|
|
1177 |
|
|
|
1156 | if len(args) == 0: | |
|
1157 | args = [t for t in os.listdir(".") | |
|
1158 | if t.startswith("test-") | |
|
1159 | and (t.endswith(".py") or t.endswith(".t"))] | |
|
1178 | 1160 | |
|
1179 | 1161 | tests = args |
|
1180 | 1162 | |
@@ -1193,8 +1175,7 b' def main():' | |||
|
1193 | 1175 | global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE |
|
1194 | 1176 | TESTDIR = os.environ["TESTDIR"] = os.getcwd() |
|
1195 | 1177 | if options.tmpdir: |
|
1196 | if not options.child: | |
|
1197 | options.keep_tmpdir = True | |
|
1178 | options.keep_tmpdir = True | |
|
1198 | 1179 | tmpdir = options.tmpdir |
|
1199 | 1180 | if os.path.exists(tmpdir): |
|
1200 | 1181 | # Meaning of tmpdir has changed since 1.3: we used to create |
@@ -1235,22 +1216,21 b' def main():' | |||
|
1235 | 1216 | os.environ["BINDIR"] = BINDIR |
|
1236 | 1217 | os.environ["PYTHON"] = PYTHON |
|
1237 | 1218 | |
|
1238 | if not options.child: | |
|
1239 |
|
|
|
1240 | os.environ["PATH"] = os.pathsep.join(path) | |
|
1219 | path = [BINDIR] + os.environ["PATH"].split(os.pathsep) | |
|
1220 | os.environ["PATH"] = os.pathsep.join(path) | |
|
1241 | 1221 | |
|
1242 |
|
|
|
1243 |
|
|
|
1244 |
|
|
|
1245 |
|
|
|
1246 |
|
|
|
1247 |
|
|
|
1248 |
|
|
|
1249 |
|
|
|
1250 |
|
|
|
1251 |
|
|
|
1252 |
|
|
|
1253 |
|
|
|
1222 | # Include TESTDIR in PYTHONPATH so that out-of-tree extensions | |
|
1223 | # can run .../tests/run-tests.py test-foo where test-foo | |
|
1224 | # adds an extension to HGRC | |
|
1225 | pypath = [PYTHONDIR, TESTDIR] | |
|
1226 | # We have to augment PYTHONPATH, rather than simply replacing | |
|
1227 | # it, in case external libraries are only available via current | |
|
1228 | # PYTHONPATH. (In particular, the Subversion bindings on OS X | |
|
1229 | # are in /opt/subversion.) | |
|
1230 | oldpypath = os.environ.get(IMPL_PATH) | |
|
1231 | if oldpypath: | |
|
1232 | pypath.append(oldpypath) | |
|
1233 | os.environ[IMPL_PATH] = os.pathsep.join(pypath) | |
|
1254 | 1234 | |
|
1255 | 1235 | COVERAGE_FILE = os.path.join(TESTDIR, ".coverage") |
|
1256 | 1236 |
General Comments 0
You need to be logged in to leave comments.
Login now