tests/run-tests.py
changeset 21367 522e3d24a461
parent 21366 5047248536c5
child 21368 a884548f5421
equal deleted inserted replaced
21366:5047248536c5 21367:522e3d24a461
  1017     def run(self, tests):
  1017     def run(self, tests):
  1018         """Run the test suite."""
  1018         """Run the test suite."""
  1019         return self._run(tests)
  1019         return self._run(tests)
  1020 
  1020 
  1021     def _run(self, tests):
  1021     def _run(self, tests):
       
  1022         # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
       
  1023         # can run .../tests/run-tests.py test-foo where test-foo
       
  1024         # adds an extension to HGRC. Also include run-test.py directory to
       
  1025         # import modules like heredoctest.
       
  1026         pypath = [self.pythondir, self.testdir,
       
  1027                   os.path.abspath(os.path.dirname(__file__))]
       
  1028         # We have to augment PYTHONPATH, rather than simply replacing
       
  1029         # it, in case external libraries are only available via current
       
  1030         # PYTHONPATH.  (In particular, the Subversion bindings on OS X
       
  1031         # are in /opt/subversion.)
       
  1032         oldpypath = os.environ.get(IMPL_PATH)
       
  1033         if oldpypath:
       
  1034             pypath.append(oldpypath)
       
  1035         os.environ[IMPL_PATH] = os.pathsep.join(pypath)
       
  1036 
       
  1037         self.coveragefile = os.path.join(self.testdir, '.coverage')
       
  1038 
  1022         vlog("# Using TESTDIR", self.testdir)
  1039         vlog("# Using TESTDIR", self.testdir)
  1023         vlog("# Using HGTMP", self.hgtmp)
  1040         vlog("# Using HGTMP", self.hgtmp)
  1024         vlog("# Using PATH", os.environ["PATH"])
  1041         vlog("# Using PATH", os.environ["PATH"])
  1025         vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
  1042         vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
  1026 
  1043 
  1442     path = [runner.bindir] + os.environ["PATH"].split(os.pathsep)
  1459     path = [runner.bindir] + os.environ["PATH"].split(os.pathsep)
  1443     if runner.tmpbindir != runner.bindir:
  1460     if runner.tmpbindir != runner.bindir:
  1444         path = [runner.tmpbindir] + path
  1461         path = [runner.tmpbindir] + path
  1445     os.environ["PATH"] = os.pathsep.join(path)
  1462     os.environ["PATH"] = os.pathsep.join(path)
  1446 
  1463 
  1447     # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
       
  1448     # can run .../tests/run-tests.py test-foo where test-foo
       
  1449     # adds an extension to HGRC. Also include run-test.py directory to import
       
  1450     # modules like heredoctest.
       
  1451     pypath = [runner.pythondir, runner.testdir,
       
  1452               os.path.abspath(os.path.dirname(__file__))]
       
  1453     # We have to augment PYTHONPATH, rather than simply replacing
       
  1454     # it, in case external libraries are only available via current
       
  1455     # PYTHONPATH.  (In particular, the Subversion bindings on OS X
       
  1456     # are in /opt/subversion.)
       
  1457     oldpypath = os.environ.get(IMPL_PATH)
       
  1458     if oldpypath:
       
  1459         pypath.append(oldpypath)
       
  1460     os.environ[IMPL_PATH] = os.pathsep.join(pypath)
       
  1461 
       
  1462     runner.coveragefile = os.path.join(runner.testdir, ".coverage")
       
  1463 
       
  1464     return runner.run(tests)
  1464     return runner.run(tests)
  1465 
  1465 
  1466 if __name__ == '__main__':
  1466 if __name__ == '__main__':
  1467     sys.exit(main(sys.argv[1:]))
  1467     sys.exit(main(sys.argv[1:]))