Skip to content

Commit 274de05

Browse files
committedAug 21, 2022
docs: ensure code blocks are highlighted properly
1 parent e6f1473 commit 274de05

File tree

8 files changed

+32
-10
lines changed

8 files changed

+32
-10
lines changed
 

‎coverage/control.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,15 @@ def set_option(self, option_name, value):
424424
appropriate Python value. For example, use True for booleans, not the
425425
string ``"True"``.
426426
427-
As an example, calling::
427+
As an example, calling:
428+
429+
.. code-block:: python
428430
429431
cov.set_option("run:branch", True)
430432
431-
has the same effect as this configuration file::
433+
has the same effect as this configuration file:
434+
435+
.. code-block:: ini
432436
433437
[run]
434438
branch = True

‎doc/config.rst

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
Configuration reference
88
=======================
99

10+
.. highlight:: ini
11+
1012
Coverage.py options can be specified in a configuration file. This makes it
1113
easier to re-run coverage.py with consistent settings, and also allows for
1214
specification of options that are otherwise only available in the

‎doc/contexts.rst

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ There are three ways to enable dynamic contexts:
6060

6161
.. _pytest-cov: https://pypi.org/project/pytest-cov/
6262

63+
.. highlight:: ini
64+
6365
The ``[run] dynamic_context`` setting has only one option now. Set it to
6466
``test_function`` to start a new dynamic context for every test function::
6567

‎doc/dbschema.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ This is the database schema:
4949
.. [[[cog
5050
import textwrap
5151
from coverage.sqldata import SCHEMA
52-
print(".. code::")
52+
print(".. code-block:: sql")
5353
print()
5454
print(textwrap.indent(SCHEMA, " "))
5555
.. ]]]
56-
.. code::
56+
.. code-block:: sql
5757
5858
CREATE TABLE coverage_schema (
5959
-- One row, to record the version of the schema in this db.
@@ -115,7 +115,7 @@ This is the database schema:
115115
foreign key (file_id) references file (id)
116116
);
117117
118-
.. [[[end]]] (checksum: 207fbab355481686e0dce0a9d99d173c)
118+
.. [[[end]]] (checksum: cfce1df016afbb43a5ff94306db56657)
119119
120120
121121
.. _numbits:

‎doc/excluding.rst

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
Excluding code from coverage.py
88
===============================
99

10+
.. highlight:: python
11+
1012
You may have code in your project that you know won't be executed, and you want
1113
to tell coverage.py to ignore it. For example, you may have debugging-only
1214
code that won't be executed during your unit tests. You can tell coverage.py to
@@ -71,6 +73,8 @@ If the matched line introduces a block, the entire block is excluded from
7173
reporting. Matching a ``def`` line or decorator line will exclude an entire
7274
function.
7375

76+
.. highlight:: ini
77+
7478
For example, you might decide that __repr__ functions are usually only used in
7579
debugging code, and are uninteresting to test themselves. You could exclude
7680
all of them by adding a regex to the exclusion list::

‎doc/faq.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ Q: Can I find out which tests ran which lines?
5454
..............................................
5555

5656
Yes! Coverage.py has a feature called :ref:`dynamic_contexts` which can collect
57-
this information. Add this to your .coveragerc file::
57+
this information. Add this to your .coveragerc file:
58+
59+
.. code-block:: ini
5860
5961
[run]
6062
dynamic_context = test_function

‎doc/plugins.rst

+10-4
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,27 @@ To use a coverage.py plug-in, you install it and configure it. For this
2525
example, let's say there's a Python package called ``something`` that provides
2626
a coverage.py plug-in called ``something.plugin``.
2727

28-
#. Install the plug-in's package as you would any other Python package::
28+
#. Install the plug-in's package as you would any other Python package:
2929

30-
pip install something
30+
.. code-block:: sh
31+
32+
$ pip install something
3133
3234
#. Configure coverage.py to use the plug-in. You do this by editing (or
3335
creating) your .coveragerc file, as described in :ref:`config`. The
3436
``plugins`` setting indicates your plug-in. It's a list of importable
35-
module names of plug-ins::
37+
module names of plug-ins:
38+
39+
.. code-block:: ini
3640
3741
[run]
3842
plugins =
3943
something.plugin
4044
4145
#. If the plug-in needs its own configuration, you can add those settings in
42-
the .coveragerc file in a section named for the plug-in::
46+
the .coveragerc file in a section named for the plug-in:
47+
48+
.. code-block:: ini
4349
4450
[something.plugin]
4551
option1 = True

‎doc/source.rst

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ file name patterns, specifying files not to measure. If both ``include`` and
5757
match the include patterns, then any files that match the omit pattern are
5858
removed from the set.
5959

60+
.. highlight:: ini
61+
6062
The ``include`` and ``omit`` file name patterns follow typical shell syntax:
6163
``*`` matches any number of characters and ``?`` matches a single character.
6264
Patterns that start with a wildcard character are used as-is, other patterns

0 commit comments

Comments
 (0)
Please sign in to comment.