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