Skip to content

Commit 8e4800e

Browse files
committed
Fixup readme
1 parent dc1efca commit 8e4800e

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

README.rst

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,18 @@ regarding to use custom hooks.
254254
``pytest_timeout_set_timer``
255255
----------------------------
256256

257-
@pytest.hookspec(firstresult=True)
258-
def pytest_timeout_set_timer(item, settings):
259-
"""Called at timeout setup.
257+
.. code:: python
260258
261-
'item' is a pytest node to setup timeout for.
259+
@pytest.hookspec(firstresult=True)
260+
def pytest_timeout_set_timer(item, settings):
261+
"""Called at timeout setup.
262262
263-
'settings' is Settings namedtuple (described below).
263+
'item' is a pytest node to setup timeout for.
264264
265-
Can be overridden by plugins for alternative timeout implementation strategies.
265+
'settings' is Settings namedtuple (described below).
266266
267-
"""
267+
Can be overridden by plugins for alternative timeout implementation strategies.
268+
"""
268269
269270
270271
``Settings``
@@ -289,31 +290,33 @@ The argument has ``Settings`` namedtuple type with the following fields:
289290
``pytest_timeout_cancel_timer``
290291
-------------------------------
291292

293+
.. code:: python
292294
293-
@pytest.hookspec(firstresult=True)
294-
def pytest_timeout_cancel_timer(item):
295-
"""Called at timeout teardown.
296-
297-
'item' is a pytest node which was used for timeout setup.
295+
@pytest.hookspec(firstresult=True)
296+
def pytest_timeout_cancel_timer(item):
297+
"""Called at timeout teardown.
298298
299-
Can be overridden by plugins for alternative timeout implementation strategies.
299+
'item' is a pytest node which was used for timeout setup.
300300
301-
"""
301+
Can be overridden by plugins for alternative timeout implementation strategies.
302+
"""
302303
303304
``is_debugging``
304305
----------------
305306

306307
When the timeout occurs, user can open the debugger session. In this case, the timeout
307308
should be discarded. A custom hook can check this case by calling ``is_debugging()``
308-
function::
309+
function:
310+
311+
.. code:: python
309312
310-
import pytest
311-
import pytest_timeout
313+
import pytest
314+
import pytest_timeout
312315
313-
def on_timeout():
314-
if pytest_timeout.is_debugging():
315-
return
316-
pytest.fail("+++ Timeout +++")
316+
def on_timeout():
317+
if pytest_timeout.is_debugging():
318+
return
319+
pytest.fail("+++ Timeout +++")
317320
318321
319322
Changelog

0 commit comments

Comments
 (0)