Skip to content

Commit 173b05d

Browse files
authored
Improves code highlighting (#95)
1 parent 45c9ab1 commit 173b05d

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

README.rst

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ terminated::
6161
pytest --timeout=300
6262

6363
Furthermore you can also use a decorator to set the timeout for an
64-
individual test. If combined with the ```--timeout``` flag this will
65-
override the timeout for this individual test::
64+
individual test. If combined with the ``--timeout`` flag this will
65+
override the timeout for this individual test:
66+
67+
.. code:: python
6668
6769
@pytest.mark.timeout(60)
6870
def test_foo():
@@ -74,7 +76,9 @@ timeout is always specified as a number of seconds, and can be
7476
defined in a number of ways, from low to high priority:
7577

7678
1. You can set a global timeout in the `pytest configuration file`__
77-
using the ``timeout`` option. E.g.::
79+
using the ``timeout`` option. E.g.:
80+
81+
.. code:: ini
7882
7983
[pytest]
8084
timeout = 300
@@ -86,7 +90,9 @@ defined in a number of ways, from low to high priority:
8690
overriding both the environment variable and configuration option.
8791

8892
4. Using the ``timeout`` marker_ on test items you can specify
89-
timeouts on a per-item basis::
93+
timeouts on a per-item basis:
94+
95+
.. code:: python
9096
9197
@pytest.mark.timeout(300)
9298
def test_foo():
@@ -159,9 +165,11 @@ The timeout method can be specified by using the ``timeout_method``
159165
option in the `pytest configuration file`__, the ``--timeout_method``
160166
command line parameter or the ``timeout`` marker_. Simply set their
161167
value to the string ``thread`` or ``signal`` to override the default
162-
method. On a marker this is done using the ``method`` keyword::
168+
method. On a marker this is done using the ``method`` keyword:
163169

164-
@pytest.mark.timeout(method='thread')
170+
.. code:: python
171+
172+
@pytest.mark.timeout(method="thread")
165173
def test_foo():
166174
pass
167175
@@ -172,7 +180,9 @@ __ https://docs.pytest.org/en/latest/reference.html#ini-options-ref
172180
The ``timeout`` Marker API
173181
==========================
174182

175-
The full signature of the timeout marker is::
183+
The full signature of the timeout marker is:
184+
185+
.. code:: python
176186
177187
pytest.mark.timeout(timeout=0, method=DEFAULT_METHOD)
178188
@@ -212,7 +222,7 @@ The way this plugin detects whether or not a debugging session is
212222
active is by checking if a trace function is set and if one is, it
213223
check to see if the module it belongs to is present in a set of known
214224
debugging frameworks modules OR if pytest itself drops you into a pdb
215-
session using ```--pdb``` or similar.
225+
session using ``--pdb`` or similar.
216226

217227

218228
Changelog

0 commit comments

Comments
 (0)