comparison tests/run-tests.py @ 4319:8ece1ba156c7

run-tests.py: use coverage.py with *.py tests
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 07 Apr 2007 04:27:55 -0300
parents b95a42114616
children f9b61e0fc929
comparison
equal deleted inserted replaced
4318:b95a42114616 4319:8ece1ba156c7
43 43
44 parser.set_defaults(timeout=180) 44 parser.set_defaults(timeout=180)
45 (options, args) = parser.parse_args() 45 (options, args) = parser.parse_args()
46 verbose = options.verbose 46 verbose = options.verbose
47 coverage = options.cover or options.cover_stdlib or options.annotate 47 coverage = options.cover or options.cover_stdlib or options.annotate
48 python = sys.executable
48 49
49 def vlog(*msg): 50 def vlog(*msg):
50 if verbose: 51 if verbose:
51 for m in msg: 52 for m in msg:
52 print m, 53 print m,
113 # windows fallback 114 # windows fallback
114 shutil.copyfile(sys.executable, my_python) 115 shutil.copyfile(sys.executable, my_python)
115 shutil.copymode(sys.executable, my_python) 116 shutil.copymode(sys.executable, my_python)
116 117
117 def install_hg(): 118 def install_hg():
119 global python
118 vlog("# Performing temporary installation of HG") 120 vlog("# Performing temporary installation of HG")
119 installerrs = os.path.join("tests", "install.err") 121 installerrs = os.path.join("tests", "install.err")
120 122
121 os.chdir("..") # Get back to hg root 123 os.chdir("..") # Get back to hg root
122 cmd = ('%s setup.py clean --all' 124 cmd = ('%s setup.py clean --all'
152 '"%s", "-x", "%s"] + sys.argv[1:])\n' % ( 154 '"%s", "-x", "%s"] + sys.argv[1:])\n' % (
153 os.path.join(TESTDIR, 'coverage.py'), 155 os.path.join(TESTDIR, 'coverage.py'),
154 os.path.join(BINDIR, '_hg.py'))) 156 os.path.join(BINDIR, '_hg.py')))
155 f.close() 157 f.close()
156 os.chmod(os.path.join(BINDIR, 'hg'), 0700) 158 os.chmod(os.path.join(BINDIR, 'hg'), 0700)
159 python = '"%s" "%s" -x' % (sys.executable,
160 os.path.join(TESTDIR,'coverage.py'))
157 161
158 def output_coverage(): 162 def output_coverage():
159 vlog("# Producing coverage report") 163 vlog("# Producing coverage report")
160 omit = [BINDIR, TESTDIR, PYTHONDIR] 164 omit = [BINDIR, TESTDIR, PYTHONDIR]
161 if not options.cover_stdlib: 165 if not options.cover_stdlib:
236 os.chdir(tmpd) 240 os.chdir(tmpd)
237 241
238 lctest = test.lower() 242 lctest = test.lower()
239 243
240 if lctest.endswith('.py'): 244 if lctest.endswith('.py'):
241 cmd = '%s "%s"' % (sys.executable, os.path.join(TESTDIR, test)) 245 cmd = '%s "%s"' % (python, os.path.join(TESTDIR, test))
242 elif lctest.endswith('.bat'): 246 elif lctest.endswith('.bat'):
243 # do not run batch scripts on non-windows 247 # do not run batch scripts on non-windows
244 if os.name != 'nt': 248 if os.name != 'nt':
245 print '\nSkipping %s: batch script' % test 249 print '\nSkipping %s: batch script' % test
246 return None 250 return None