diff options
-rw-r--r-- | doc/_static/coverage.css | 27 | ||||
-rw-r--r-- | doc/conf.py | 1 | ||||
-rw-r--r-- | doc/index.rst | 65 | ||||
-rw-r--r-- | doc/requirements.pip | 1 |
4 files changed, 78 insertions, 16 deletions
diff --git a/doc/_static/coverage.css b/doc/_static/coverage.css index 9726bbf4..15a55508 100644 --- a/doc/_static/coverage.css +++ b/doc/_static/coverage.css @@ -15,6 +15,33 @@ img.tideliftlogo { margin-top: .5em !important; } +.rst-content div[class^="highlight"] { + margin-bottom: 12px; +} + +.rst-content ol.arabic li { + margin-bottom: 12px; +} + +/* Tabs */ + +.ui.menu { + font-family: Helvetica; + min-height: 0; +} + +.ui.tabular.menu .item { + padding: .25em 1em; +} + +.ui.menu .item { + padding: 0; +} + +.sphinx-tabs { + margin-bottom: 1em; +} + /* .. parsed-literal:: isn't styled like other <pre> blocks!? */ .rst-content pre.literal-block { diff --git a/doc/conf.py b/doc/conf.py index 06ad176a..ccdf7a65 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -42,6 +42,7 @@ extensions = [ 'sphinx_rst_builder', 'sphinx.ext.extlinks', 'sphinx.ext.napoleon', + 'sphinx_tabs.tabs', ] # Add any paths that contain templates here, relative to this directory. diff --git a/doc/index.rst b/doc/index.rst index 7e4b4f6b..214593da 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -56,27 +56,60 @@ Quick start Getting started is easy: -#. Install coverage.py in the usual way, with ``pip install coverage``, or - from the `coverage.py page on the Python Package Index`_. For a few more - details, see :ref:`install`. +#. Install coverage.py:: + + $ pip install coverage + + For more details, see :ref:`install`. #. 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":: + normally run your test suite, you can run your test runner under coverage. + If your test runner command starts with "python", just replace the initial + "python" with "coverage run". - # if you usually do: - # - # $ python -m pytest arg1 arg2 - # - # then instead do: + Instructions for specific test runners: - $ coverage run -m pytest arg1 arg2 - blah blah ..your tests' output.. blah blah + .. tabs:: - To limit coverage measurement to code in the current directory, and also - find files that weren't executed at all, use:: + .. tab:: pytest + + If you usually use:: + + $ pytest arg1 arg2 arg3 + + then you can run your tests under coverage with:: + + $ coverage run -m pytest arg1 arg2 arg3 + + Many people choose to use the `pytest-cov`_ plugin, but for most + purposes, it is unnecessary. + + .. tab:: unittest + + Change "python" to "coverage run", so this:: + + $ python -m unittest discover - $ coverage run --source=. -m pytest + becomes:: + + $ coverage run -m unittest discover + + .. tab:: nosetest + + *Nose has been unmaintained for a long time. You should seriously + consider adopting a different test runner.* + + Change this:: + + $ nosetests arg1 arg2 + + to:: + + $ coverage run -m nose arg1 arg2 + + To limit coverage measurement to code in the current directory, and also + find files that weren't executed at all, add the ``--source=.`` argument to + your coverage command line. #. Use ``coverage report`` to report on the results:: @@ -103,7 +136,7 @@ Getting started is easy: Then open htmlcov/index.html in your browser, to see a `report like this one`_. -.. _coverage.py page on the Python Package Index: https://pypi.org/project/coverage/ + .. _report like this: https://nedbatchelder.com/files/sample_coverage_html/index.html .. _report like this one: https://nedbatchelder.com/files/sample_coverage_html_beta/index.html diff --git a/doc/requirements.pip b/doc/requirements.pip index 2722c9bd..3529fba3 100644 --- a/doc/requirements.pip +++ b/doc/requirements.pip @@ -9,3 +9,4 @@ sphinx-rst-builder==0.0.1 sphinxcontrib-spelling==4.3.0 sphinx_rtd_theme==0.4.3 sphinx-autobuild==0.7.1 +sphinx-tabs==1.1.13 |