summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-11-16 12:24:31 -0500
committerNed Batchelder <ned@nedbatchelder.com>2019-11-16 12:24:31 -0500
commite72fff05663c80268841a4fd77b40fbc2988e25d (patch)
tree14b44ad910c220cc255eabeab104f5088ba97639
parent2aeb189280ad89b1fdc67529438c6c98668b9d6f (diff)
downloadpython-coveragepy-git-e72fff05663c80268841a4fd77b40fbc2988e25d.tar.gz
Better getting started
-rw-r--r--Makefile5
-rw-r--r--doc/index.rst23
2 files changed, 15 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 6775e751..3556c038 100644
--- a/Makefile
+++ b/Makefile
@@ -141,8 +141,9 @@ docreqs:
dochtml: docreqs ## Build the docs HTML output.
.tox/doc/bin/python doc/check_copied_from.py doc/*.rst
$(SPHINXBUILD) -b html doc doc/_build/html
- @echo "This might be useful:"
- @echo "open doc/_build/html/index.html"
+
+docopen: dochtml
+ open doc/_build/html/index.html
docspell: docreqs
$(SPHINXBUILD) -b spelling doc doc/_spell
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