tests/run-tests.py
branchstable
changeset 1227 afafc1812f7b
parent 1226 0dd96ff409e9
child 1228 db145eefc724
equal deleted inserted replaced
1226:0dd96ff409e9 1227:afafc1812f7b
   902             assert '=' in key, ('extra config opt %s must '
   902             assert '=' in key, ('extra config opt %s must '
   903                                 'have an = for assignment' % opt)
   903                                 'have an = for assignment' % opt)
   904             hgrc.write('[%s]\n%s\n' % (section, key))
   904             hgrc.write('[%s]\n%s\n' % (section, key))
   905     hgrc.close()
   905     hgrc.close()
   906 
   906 
   907     ref = os.path.join(TESTDIR, test+".out")
       
   908     err = os.path.join(TESTDIR, test+".err")
   907     err = os.path.join(TESTDIR, test+".err")
   909     if os.path.exists(err):
   908     if os.path.exists(err):
   910         os.remove(err)       # Remove any previous output files
   909         os.remove(err)       # Remove any previous output files
   911     lctest = test.lower()
   910     lctest = test.lower()
   912 
   911 
   913     if lctest.endswith('.py'):
   912     for ext, func, out in testtypes:
   914         runner = pytest
   913         if lctest.endswith(ext):
   915     elif lctest.endswith('.t'):
   914             runner = func
   916         runner = tsttest
   915             ref = os.path.join(TESTDIR, test + out)
   917         ref = testpath
   916             break
   918     else:
   917     else:
   919         return skip("unknown test type")
   918         return skip("unknown test type")
   920 
   919 
   921     # Make a tmp subdirectory to work in
   920     # Make a tmp subdirectory to work in
   922     testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
   921     testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
  1232             print "\ninterrupted!"
  1231             print "\ninterrupted!"
  1233 
  1232 
  1234     if failed:
  1233     if failed:
  1235         sys.exit(1)
  1234         sys.exit(1)
  1236 
  1235 
       
  1236 testtypes = [('.py', pytest, '.out'),
       
  1237              ('.t', tsttest, '')]
       
  1238 
  1237 def main():
  1239 def main():
  1238     (options, args) = parseargs()
  1240     (options, args) = parseargs()
  1239     if not options.child:
  1241     if not options.child:
  1240         os.umask(022)
  1242         os.umask(022)
  1241 
  1243