tests/run-tests.py
branchstable
changeset 1247 7691a1e24745
parent 1246 e6ba976e152c
child 1248 44c6de7459a7
equal deleted inserted replaced
1246:e6ba976e152c 1247:7691a1e24745
   360             assert '=' in key, ('extra config opt %s must '
   360             assert '=' in key, ('extra config opt %s must '
   361                                 'have an = for assignment' % opt)
   361                                 'have an = for assignment' % opt)
   362             hgrc.write('[%s]\n%s\n' % (section, key))
   362             hgrc.write('[%s]\n%s\n' % (section, key))
   363     hgrc.close()
   363     hgrc.close()
   364 
   364 
       
   365 def createenv(options, testtmp):
       
   366     env = os.environ.copy()
       
   367     env['TESTTMP'] = testtmp
       
   368     env['HOME'] = testtmp
       
   369     env["HGPORT"] = str(options.port)
       
   370     env["HGPORT1"] = str(options.port + 1)
       
   371     env["HGPORT2"] = str(options.port + 2)
       
   372     env["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
       
   373     env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
       
   374 
       
   375     return env
   365 
   376 
   366 def checktools():
   377 def checktools():
   367     # Before we go any further, check for pre-requisite tools
   378     # Before we go any further, check for pre-requisite tools
   368     # stuff from coreutils (cat, rm, etc) are not tested
   379     # stuff from coreutils (cat, rm, etc) are not tested
   369     for p in requiredtools:
   380     for p in requiredtools:
   925                      '\\' + c
   936                      '\\' + c
   926                      for c in testtmp), '$TESTTMP'))
   937                      for c in testtmp), '$TESTTMP'))
   927     else:
   938     else:
   928         replacements.append((re.escape(testtmp), '$TESTTMP'))
   939         replacements.append((re.escape(testtmp), '$TESTTMP'))
   929 
   940 
   930     env = os.environ.copy()
   941     env = createenv(options, testtmp)
   931     env['TESTTMP'] = testtmp
       
   932     env['HOME'] = testtmp
       
   933     env["HGPORT"] = str(options.port)
       
   934     env["HGPORT1"] = str(options.port + 1)
       
   935     env["HGPORT2"] = str(options.port + 2)
       
   936     env["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
       
   937     env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
       
   938 
       
   939     createhgrc(env['HGRCPATH'], options)
   942     createhgrc(env['HGRCPATH'], options)
   940 
   943 
   941     if options.time:
   944     if options.time:
   942         starttime = time.time()
   945         starttime = time.time()
   943     ret, out = runner(testpath, testtmp, options, replacements, env)
   946     ret, out = runner(testpath, testtmp, options, replacements, env)