/IPython/testing/__init__.py

https://github.com/minrk/ipython
Python | 49 lines | 16 code | 8 blank | 25 comment | 1 complexity | 032c418346685291902c8444fb78c05c MD5 | raw file
  1. """Testing support (tools to test IPython itself).
  2. """
  3. #-----------------------------------------------------------------------------
  4. # Copyright (C) 2009-2011 The IPython Development Team
  5. #
  6. # Distributed under the terms of the BSD License. The full license is in
  7. # the file COPYING, distributed as part of this software.
  8. #-----------------------------------------------------------------------------
  9. import os
  10. #-----------------------------------------------------------------------------
  11. # Functions
  12. #-----------------------------------------------------------------------------
  13. # User-level entry point for testing
  14. def test(**kwargs):
  15. """Run the entire IPython test suite.
  16. Any of the options for run_iptestall() may be passed as keyword arguments.
  17. For example::
  18. IPython.test(testgroups=['lib', 'config', 'utils'], fast=2)
  19. will run those three sections of the test suite, using two processes.
  20. """
  21. # Do the import internally, so that this function doesn't increase total
  22. # import time
  23. from .iptestcontroller import run_iptestall, default_options
  24. options = default_options()
  25. for name, val in kwargs.items():
  26. setattr(options, name, val)
  27. run_iptestall(options)
  28. #-----------------------------------------------------------------------------
  29. # Constants
  30. #-----------------------------------------------------------------------------
  31. # We scale all timeouts via this factor, slow machines can increase it
  32. IPYTHON_TESTING_TIMEOUT_SCALE = float(os.getenv(
  33. 'IPYTHON_TESTING_TIMEOUT_SCALE', 1))
  34. # So nose doesn't try to run this as a test itself and we end up with an
  35. # infinite test loop
  36. test.__test__ = False