tests/run-tests.py
changeset 49084 ea98850a136e
parent 48963 7e18fc0bc46c
parent 49047 c827bb7b5806
child 49217 13dfad0f9f7a
equal deleted inserted replaced
49083:1c00777702da 49084:ea98850a136e
  1400 
  1400 
  1401         env = os.environ.copy()
  1401         env = os.environ.copy()
  1402         env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
  1402         env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
  1403         env['HGEMITWARNINGS'] = '1'
  1403         env['HGEMITWARNINGS'] = '1'
  1404         env['TESTTMP'] = _bytes2sys(self._testtmp)
  1404         env['TESTTMP'] = _bytes2sys(self._testtmp)
       
  1405         # the FORWARD_SLASH version is useful when running `sh` on non unix
       
  1406         # system (e.g. Windows)
       
  1407         env['TESTTMP_FORWARD_SLASH'] = env['TESTTMP'].replace(os.sep, '/')
  1405         uid_file = os.path.join(_bytes2sys(self._testtmp), 'UID')
  1408         uid_file = os.path.join(_bytes2sys(self._testtmp), 'UID')
  1406         env['HGTEST_UUIDFILE'] = uid_file
  1409         env['HGTEST_UUIDFILE'] = uid_file
  1407         env['TESTNAME'] = self.name
  1410         env['TESTNAME'] = self.name
  1408         env['HOME'] = _bytes2sys(self._testtmp)
  1411         env['HOME'] = _bytes2sys(self._testtmp)
  1409         if WINDOWS:
  1412         if WINDOWS:
  3063         if testdescs:
  3066         if testdescs:
  3064             pathname = os.path.dirname(testdescs[0]['path'])
  3067             pathname = os.path.dirname(testdescs[0]['path'])
  3065             if pathname:
  3068             if pathname:
  3066                 testdir = os.path.join(testdir, pathname)
  3069                 testdir = os.path.join(testdir, pathname)
  3067         self._testdir = osenvironb[b'TESTDIR'] = testdir
  3070         self._testdir = osenvironb[b'TESTDIR'] = testdir
       
  3071         osenvironb[b'TESTDIR_FORWARD_SLASH'] = osenvironb[b'TESTDIR'].replace(
       
  3072             os.sep.encode('ascii'), b'/'
       
  3073         )
       
  3074 
  3068         if self.options.outputdir:
  3075         if self.options.outputdir:
  3069             self._outputdir = canonpath(_sys2bytes(self.options.outputdir))
  3076             self._outputdir = canonpath(_sys2bytes(self.options.outputdir))
  3070         else:
  3077         else:
  3071             self._outputdir = getcwdb()
  3078             self._outputdir = getcwdb()
  3072             if testdescs and pathname:
  3079             if testdescs and pathname:
  3207         osenvironb[b"PYTHON"] = PYTHON
  3214         osenvironb[b"PYTHON"] = PYTHON
  3208 
  3215 
  3209         fileb = _sys2bytes(__file__)
  3216         fileb = _sys2bytes(__file__)
  3210         runtestdir = os.path.abspath(os.path.dirname(fileb))
  3217         runtestdir = os.path.abspath(os.path.dirname(fileb))
  3211         osenvironb[b'RUNTESTDIR'] = runtestdir
  3218         osenvironb[b'RUNTESTDIR'] = runtestdir
       
  3219         osenvironb[b'RUNTESTDIR_FORWARD_SLASH'] = runtestdir.replace(
       
  3220             os.sep.encode('ascii'), b'/'
       
  3221         )
  3212         sepb = _sys2bytes(os.pathsep)
  3222         sepb = _sys2bytes(os.pathsep)
  3213         path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb)
  3223         path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb)
  3214         if os.path.islink(__file__):
  3224         if os.path.islink(__file__):
  3215             # test helper will likely be at the end of the symlink
  3225             # test helper will likely be at the end of the symlink
  3216             realfile = os.path.realpath(fileb)
  3226             realfile = os.path.realpath(fileb)