Test discovery

If you write a Python package, various tests might be spread out through the package. The discover module finds, imports, and runs these test cases. The basic call from the command line is:

python -m unittest discover

It starts looking for test cases in the current directory and recurses the directory tree downward to find Python objects with the 'test' string contained in its name. The command takes optional arguments. Most important are -s to modify the start directory and -p to define the pattern to recognize the tests:

python -m unittest discover -s '.' -p 'Test*.py'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.38.121