run-tests.py: use coverage.py with "#!/usr/bin/env python" tests
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 07 Apr 2007 04:27:55 -0300
changeset 4321 99184c6fd88f
parent 4320 f9b61e0fc929
child 4322 38922a13101e
run-tests.py: use coverage.py with "#!/usr/bin/env python" tests
tests/run-tests.py
--- 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