tests/run-tests.py
changeset 4321 99184c6fd88f
parent 4320 f9b61e0fc929
child 4361 46280c004f22
equal deleted inserted replaced
4320:f9b61e0fc929 4321:99184c6fd88f
   238     # Make a tmp subdirectory to work in
   238     # Make a tmp subdirectory to work in
   239     tmpd = os.path.join(HGTMP, test)
   239     tmpd = os.path.join(HGTMP, test)
   240     os.mkdir(tmpd)
   240     os.mkdir(tmpd)
   241     os.chdir(tmpd)
   241     os.chdir(tmpd)
   242 
   242 
       
   243     try:
       
   244         tf = open(testpath)
       
   245         firstline = tf.readline().rstrip()
       
   246         tf.close()
       
   247     except:
       
   248         firstline = ''
   243     lctest = test.lower()
   249     lctest = test.lower()
   244 
   250 
   245     if lctest.endswith('.py'):
   251     if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
   246         cmd = '%s "%s"' % (python, testpath)
   252         cmd = '%s "%s"' % (python, testpath)
   247     elif lctest.endswith('.bat'):
   253     elif lctest.endswith('.bat'):
   248         # do not run batch scripts on non-windows
   254         # do not run batch scripts on non-windows
   249         if os.name != 'nt':
   255         if os.name != 'nt':
   250             print '\nSkipping %s: batch script' % test
   256             print '\nSkipping %s: batch script' % test