python-coverage.1.txt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. ===============
  2. python-coverage
  3. ===============
  4. -------------------------------------------------
  5. measure code coverage of Python program execution
  6. -------------------------------------------------
  7. :Author: Ned Batchelder <ned@nedbatchelder.com>
  8. :Author: |author|
  9. :Date: 2015-09-20
  10. :Copyright: Apache 2.0 license, attribution and disclaimer required.
  11. :Manual section: 1
  12. :Manual group: Coverage.py
  13. .. |command| replace:: **python-coverage**
  14. ..
  15. To test this file:
  16. $ rst2man < doc/python-coverage.1.txt | groff -man -Tascii
  17. SYNOPSIS
  18. ========
  19. | |command| `command` [ `option` ... ]
  20. | |command| **help** [ `command` ]
  21. DESCRIPTION
  22. ===========
  23. |command| executes a Python program and measures which of its statements are
  24. executed and which are not, and reports these coverage measurements.
  25. COMMAND OVERVIEW
  26. ================
  27. |command| **annotate**
  28. Annotate source files with execution information.
  29. |command| **combine**
  30. Combine a number of data files.
  31. |command| **erase**
  32. Erase previously collected coverage data.
  33. |command| **help**
  34. Get help on using coverage.py.
  35. |command| **html**
  36. Create an HTML report.
  37. |command| **report**
  38. Report coverage stats on modules.
  39. |command| **run**
  40. Run a Python program and measure code execution.
  41. |command| **xml**
  42. Create an XML report of coverage results.
  43. GLOBAL OPTIONS
  44. ==============
  45. **--help**, **-h**
  46. Describe how to use coverage.py, in general or a command.
  47. **--rcfile** `RCFILE`
  48. Specify configuration file `RCFILE`. Defaults to ``.coveragerc``.
  49. **--omit** `PATTERN` [ , ... ]
  50. Omit files when their file name matches one of these PATTERNs.
  51. Usually needs quoting on the command line.
  52. **--include** `PATTERN` [ , ... ]
  53. Include only files whose paths match one of these
  54. PATTERNs. Accepts shell-style wildcards, which must be quoted.
  55. **--debug** `DEBUGOPT`,...
  56. Debug options `DEBUGOPT`, separated by commas.
  57. COMMAND REFERENCE
  58. =================
  59. **annotate** [ `option` ... ]
  60. Options:
  61. \-d `DIR`, --directory=`DIR`
  62. Write the output files to DIR.
  63. \-i, --ignore-errors
  64. Ignore errors while reading source files.
  65. **combine** [ `option` ... ] [ `PATH` ... ]
  66. Combine data from multiple coverage files collected with ``run -p``.
  67. The combined results are written to a single file representing the
  68. union of the data.
  69. If `PATH` is specified, they are files or directories containing data to
  70. be combined.
  71. Options:
  72. \--append
  73. Append coverage data to .coverage, otherwise it starts clean each
  74. time.
  75. **erase**
  76. Erase previously collected coverage data.
  77. **help** [ `command` ]
  78. Describe how to use coverage.py.
  79. **html** [ `option` ... ] [ `MODULE` ... ]
  80. Create an HTML report of the coverage of each `MODULE` file. Each file
  81. gets its own page, with the source decorated to show executed,
  82. excluded, and missed lines.
  83. Options:
  84. \-d `DIR`, --directory `DIR`
  85. Write the output files to `DIR`.
  86. \--fail-under `MIN`
  87. Exit with a status of 2 if the total coverage is less than `MIN`.
  88. \-i, --ignore-errors
  89. Ignore errors while reading source files.
  90. \--title `TITLE`
  91. Use the text string `TITLE` as the title on the HTML.
  92. **report** [ `option` ... ] [ `MODULE` ... ]
  93. Report coverage statistics on each `MODULE`.
  94. Options:
  95. \--fail-under `MIN`
  96. Exit with a status of 2 if the total coverage is less than `MIN`.
  97. \-i, --ignore-errors
  98. Ignore errors while reading source files.
  99. \-m, --show-missing
  100. Show line numbers of statements in each module that weren't
  101. executed.
  102. \--skip-covered
  103. Skip files with 100% coverage.
  104. **run** [ `options` ... ] `PROGRAMFILE` [ `program_options` ]
  105. Run a Python program `PROGRAMFILE`, measuring code execution.
  106. Options:
  107. \-a, --append
  108. Append coverage data to .coverage, otherwise it is started clean
  109. with each run.
  110. \--branch
  111. Measure branch coverage in addition to statement coverage.
  112. \--concurrency `LIB`
  113. Properly measure code using a concurrency library. Valid values are:
  114. thread, gevent, greenlet, eventlet, multiprocessing.
  115. \-L, --pylib
  116. Measure coverage even inside the Python installed library, which
  117. isn't done by default.
  118. \-p, --parallel-mode
  119. Append the machine name, process id and random number to the
  120. ``.coverage`` data file name to simplify collecting data from many
  121. processes.
  122. \--source `SOURCE` ...
  123. A list of packages or directories of code to be measured.
  124. \--timid
  125. Use a simpler but slower trace method. Try this if you get
  126. seemingly impossible results!
  127. **xml** [ `options` ... ] [ `MODULES` ... ]
  128. Generate an XML report of coverage results on each `MODULE`.
  129. Options:
  130. \--fail-under `MIN`
  131. Exit with a status of 2 if the total coverage is less than `MIN`.
  132. \-i, --ignore-errors
  133. Ignore errors while reading source files.
  134. \-o `OUTFILE`
  135. Write the XML report to `OUTFILE`. Defaults to ``coverage.xml``.
  136. ENVIRONMENT VARIABLES
  137. =====================
  138. COVERAGE_FILE
  139. Path to the file where coverage measurements are collected to and
  140. reported from. Default: ``.coverage`` in the current working directory.
  141. HISTORY
  142. =======
  143. The |command| command is a Python program which calls the ``coverage``
  144. Python library to do all the work.
  145. The library was originally developed by Gareth Rees, and is now developed
  146. by Ned Batchelder.
  147. This manual page was written by |author|.
  148. .. |author| replace:: |authorname| |authoremail|
  149. .. |authorname| replace:: Ben Finney
  150. .. |authoremail| replace:: <ben+python@benfinney.id.au>
  151. ..
  152. Local variables:
  153. mode: rst
  154. coding: utf-8
  155. time-stamp-format: "%:y-%02m-%02d"
  156. time-stamp-start: "^:Date:[ ]+"
  157. time-stamp-end: "$"
  158. time-stamp-line-limit: 20
  159. End:
  160. vim: filetype=rst fileencoding=utf-8 :