##// END OF EJS Templates
tests: add -3 switch to run-tests.py
Alejandro Santos -
r9028:bea567ae default
parent child Browse files
Show More
@@ -119,6 +119,8 b' def parseargs():'
119 help="shortcut for --with-hg=<testdir>/../hg")
119 help="shortcut for --with-hg=<testdir>/../hg")
120 parser.add_option("--pure", action="store_true",
120 parser.add_option("--pure", action="store_true",
121 help="use pure Python code instead of C extensions")
121 help="use pure Python code instead of C extensions")
122 parser.add_option("-3", "--py3k-warnings", action="store_true",
123 help="enable Py3k warnings on Python 2.6+")
122
124
123 for option, default in defaults.items():
125 for option, default in defaults.items():
124 defaults[option] = int(os.environ.get(*default))
126 defaults[option] = int(os.environ.get(*default))
@@ -171,6 +173,10 b' def parseargs():'
171 if options.interactive and options.jobs > 1:
173 if options.interactive and options.jobs > 1:
172 print '(--interactive overrides --jobs)'
174 print '(--interactive overrides --jobs)'
173 options.jobs = 1
175 options.jobs = 1
176 if options.py3k_warnings:
177 if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
178 print 'ERROR: Py3k warnings switch can only be used on Python 2.6+'
179 sys.exit(1)
174
180
175 return (options, args)
181 return (options, args)
176
182
@@ -299,6 +305,17 b' def installhg(options):'
299 f.close()
305 f.close()
300 os.chmod(os.path.join(BINDIR, 'diffstat'), 0700)
306 os.chmod(os.path.join(BINDIR, 'diffstat'), 0700)
301
307
308 if options.py3k_warnings and not options.anycoverage:
309 vlog("# Updating hg command to enable Py3k Warnings switch")
310 f = open(os.path.join(BINDIR, 'hg'), 'r')
311 lines = [line.rstrip() for line in f]
312 lines[0] += ' -3'
313 f.close()
314 f = open(os.path.join(BINDIR, 'hg'), 'w')
315 for line in lines:
316 f.write(line + '\n')
317 f.close()
318
302 if options.anycoverage:
319 if options.anycoverage:
303 vlog("# Installing coverage wrapper")
320 vlog("# Installing coverage wrapper")
304 os.environ['COVERAGE_FILE'] = COVERAGE_FILE
321 os.environ['COVERAGE_FILE'] = COVERAGE_FILE
@@ -432,7 +449,8 b' def runone(options, test, skips, fails):'
432 lctest = test.lower()
449 lctest = test.lower()
433
450
434 if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
451 if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
435 cmd = '%s "%s"' % (PYTHON, testpath)
452 py3kswitch = options.py3k_warnings and ' -3' or ''
453 cmd = '%s%s "%s"' % (PYTHON, py3kswitch, testpath)
436 elif lctest.endswith('.bat'):
454 elif lctest.endswith('.bat'):
437 # do not run batch scripts on non-windows
455 # do not run batch scripts on non-windows
438 if os.name != 'nt':
456 if os.name != 'nt':
General Comments 0
You need to be logged in to leave comments. Login now