testing.rst 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Testing with nose
  2. =================
  3. Writing tests is easier
  4. -----------------------
  5. nose collects tests from :class:`unittest.TestCase` subclasses, of course. But
  6. you can also write simple test functions, as well as test classes that are
  7. *not* subclasses of :class:`unittest.TestCase`. nose also supplies a number of
  8. helpful functions for writing timed tests, testing for exceptions, and other
  9. common use cases. See :doc:`writing_tests` and :doc:`testing_tools` for more.
  10. Running tests is easier
  11. -----------------------
  12. nose collects tests automatically, as long as you follow some simple
  13. guidelines for organizing your library and test code. There's no need
  14. to manually collect test cases into test suites. Running tests is
  15. responsive, since nose begins running tests as soon as the first test
  16. module is loaded. See :doc:`finding_tests` for more.
  17. Setting up your test environment is easier
  18. ------------------------------------------
  19. nose supports fixtures at the package, module, class, and test case
  20. level, so expensive initialization can be done as infrequently as
  21. possible. See :ref:`fixtures` for more.
  22. Doing what you want to do is easier
  23. -----------------------------------
  24. nose comes with a number of :doc:`builtin plugins <plugins/builtin>` to help
  25. you with output capture, error introspection, code coverage, doctests, and
  26. more. It also comes with plugin hooks for loading, running, watching and
  27. reporting on tests and test runs. If you don't like the default collection
  28. scheme, or it doesn't suit the layout of your project, or you need reports in
  29. a format different from the unittest standard, or you need to collect some
  30. additional information about tests (like code coverage or profiling data), you
  31. can write a plugin to make nose do what you want. See the section on
  32. :doc:`plugins/writing` for more. There are also many
  33. `third-party nose plugins <http://nose-plugins.jottit.com/>`_ available.
  34. Details
  35. -------
  36. .. toctree ::
  37. :maxdepth: 2
  38. usage
  39. writing_tests
  40. finding_tests
  41. testing_tools
  42. plugins/builtin
  43. plugins/other
  44. setuptools_integration