changeset 4321:99184c6fd88f

run-tests.py: use coverage.py with "#!/usr/bin/env python" tests
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 07 Apr 2007 04:27:55 -0300
parents f9b61e0fc929
children 38922a13101e
files tests/run-tests.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sat Apr 07 04:27:55 2007 -0300
+++ b/tests/run-tests.py	Sat Apr 07 04:27:55 2007 -0300
@@ -240,9 +240,15 @@
     os.mkdir(tmpd)
     os.chdir(tmpd)
 
+    try:
+        tf = open(testpath)
+        firstline = tf.readline().rstrip()
+        tf.close()
+    except:
+        firstline = ''
     lctest = test.lower()
 
-    if lctest.endswith('.py'):
+    if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
         cmd = '%s "%s"' % (python, testpath)
     elif lctest.endswith('.bat'):
         # do not run batch scripts on non-windows