diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-11-16 12:24:31 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-11-16 12:24:31 -0500 |
commit | e72fff05663c80268841a4fd77b40fbc2988e25d (patch) | |
tree | 14b44ad910c220cc255eabeab104f5088ba97639 /doc/index.rst | |
parent | 2aeb189280ad89b1fdc67529438c6c98668b9d6f (diff) | |
download | python-coveragepy-git-e72fff05663c80268841a4fd77b40fbc2988e25d.tar.gz |
Better getting started
Diffstat (limited to 'doc/index.rst')
-rw-r--r-- | doc/index.rst | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/doc/index.rst b/doc/index.rst index 484bad96..62026d0d 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -73,22 +73,25 @@ Getting started is easy: or by using "pip install coverage". For a few more details, see :ref:`install`. -#. Use ``coverage run`` to run your program and gather data: - - .. code-block:: console +#. Use ``coverage run`` to run your test suite and gather data. However you + normally run your test suite, replace the initial word "python" with + "coverage run":: # if you usually do: # - # $ python my_program.py arg1 arg2 + # $ python -m pytest arg1 arg2 # # then instead do: - $ coverage run my_program.py arg1 arg2 - blah blah ..your program's output.. blah blah + $ coverage run -m pytest arg1 arg2 + blah blah ..your tests' output.. blah blah + + To limit coverage measurement to code in the current directory, and also + find files that weren't executed at all, use:: -#. Use ``coverage report`` to report on the results: + $ coverage run --source=. -m pytest - .. code-block:: console +#. Use ``coverage report`` to report on the results:: $ coverage report -m Name Stmts Miss Cover Missing @@ -99,9 +102,7 @@ Getting started is easy: TOTAL 76 10 87% #. For a nicer presentation, use ``coverage html`` to get annotated HTML - listings detailing missed lines: - - .. code-block:: console + listings detailing missed lines:: $ coverage html |