/doc/finding_tests.rst

https://bitbucket.org/jpellerin/nose/ · ReStructuredText · 32 lines · 24 code · 8 blank · 0 comment · 0 complexity · 657359e3e4dc829d8a82a4ce83f5031b MD5 · raw file

  1. Finding and running tests
  2. -------------------------
  3. nose, by default, follows a few simple rules for test discovery.
  4. * If it looks like a test, it's a test. Names of directories, modules,
  5. classes and functions are compared against the testMatch regular
  6. expression, and those that match are considered tests. Any class that is a
  7. `unittest.TestCase` subclass is also collected, so long as it is inside of a
  8. module that looks like a test.
  9. * Directories that don't look like tests and aren't packages are not
  10. inspected.
  11. * Packages are always inspected, but they are only collected if they look
  12. like tests. This means that you can include your tests inside of your
  13. packages (somepackage/tests) and nose will collect the tests without
  14. running package code inappropriately.
  15. * When a project appears to have library and test code organized into
  16. separate directories, library directories are examined first.
  17. * When nose imports a module, it adds that module's directory to sys.path;
  18. when the module is inside of a package, like package.module, it will be
  19. loaded as package.module and the directory of *package* will be added to
  20. sys.path.
  21. * If an object defines a __test__ attribute that does not evaluate to
  22. True, that object will not be collected, nor will any objects it
  23. contains.
  24. Be aware that plugins and command line options can change any of those rules.