Before giving you a detailed introduction to the Python code, let's take a look at the Python code coverage statistics Tool coverage. py, and then give a full introduction to the Python code. The following is a detailed description of the relevant issues. I hope you can use it later.
Use easy-install to install:
- easy_install coverage
After installation, a coverage.exe file is installed in c: \ Python25 \ Scripts. This exe can basically complete all the functions we need. Run it. If you find that the module is missing, install
- easy_install。
-
- Coverage Command Line
-
The key parameters are as follows:
1. run
To execute code coverage rate statistics, you only need to run the Statistical Code through the coverage run parameter.
After running, a coverage statistical result file is automatically generated. coverage. If you want to modify the default file name, you only need to set the COVERAGE_FILE environment variable.
2. report
With the coverage rate statistical result file, you only need to run the report parameter to view the statistical result in the command.
- $ coverage report
- Name Stmts Exec Cover
- ---------------------------------------------
- my_program 20 16 80%
- my_module 15 13 86%
- my_other_module 56 50 89%
- ---------------------------------------------
- TOTAL 91 79 87%
3. html
The most handsome and cool function is to generate the html test report directly.
- $ coverage report
- Name Stmts Exec Cover
- ---------------------------------------------
- my_program 20 16 80%
- my_module 15 13 86%
- my_other_module 56 50 89%
- ---------------------------------------------
- TOTAL 91 79 87%
-
The above article describes how to install Python code. I hope you will get the information you want.
- Three application solutions in Python logic operations
- Effect of Python environment Initialization
- Python string operation manual in practice
- Find your own voice in the game using the Python script
- How to Implement Python in C