@@ -61,8 +61,10 @@ terminated::
6161 pytest --timeout=300
6262
6363Furthermore 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
7476defined in a number of ways, from low to high priority:
7577
76781. 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
88924. 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``
159165option in the `pytest configuration file `__, the ``--timeout_method ``
160166command line parameter or the ``timeout `` marker _. Simply set their
161167value 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
172180The ``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
212222active is by checking if a trace function is set and if one is, it
213223check to see if the module it belongs to is present in a set of known
214224debugging 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
218228Changelog
0 commit comments