This software backports test discovery functionality from Python 2.7 to earlier versions of the language starting from Python 2.4. It enables easier identification and organization of unit tests for efficient software testing.
The Discover module has a range of options to control its behavior. These options include -v, --verbose for verbose output, -s for the directory to start the discovery process, with the default being '.', -p for the pattern to match test files with 'test*.py' as its default, and -t for the top-level directory of the project, which defaults to the start directory.
In test discovery, all test modules must be importable from the top level directory of the project. This is implemented in discover.DiscoveringTestLoader.discover. This method finds and returns all test modules from the specified start directory, with recursion into subdirectories for finding them. Only test files that match the pattern would be loaded, using shell-style pattern matching.
The software tool has a specification that requires all test modules to be importable from the top level of the project. If the start directory is not the top level directory, then the top-level directory must be specified separately. If a test package name (directory with __init__.py) matches the pattern, then the package would be checked for a load_tests function. If this exists, then it would be called with loader, tests, pattern. If load_tests exists, then discovery would not recurse into the package, as load_tests is responsible for loading all tests in the package.
The pattern is deliberately not stored as a loader attribute, so that packages can continue the discovery process themselves. The top_level_dir is stored, so load_tests does not need to pass this argument in to loader.discover(). Overall, Discover is a beneficial software tool for discovering tests, and its options provide exceptional control for users.
Version 0.3.1: N/A