From 23ca9798f7a119615017c177fc884e2f77c23abc Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 11 Jun 2024 18:36:20 +0300 Subject: [PATCH] doc: fix broken code blocks (#12449) Caused by 4588653b2497ed25976b7aaff225b889fb476756. The issue was fixed in https://github.com/astral-sh/ruff/issues/11577, so won't trigger again. Fix #12437. --- src/_pytest/capture.py | 4 ++++ src/_pytest/config/__init__.py | 1 + src/_pytest/monkeypatch.py | 1 + src/_pytest/pytester.py | 3 +++ 4 files changed, 9 insertions(+) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 198d41950..89a938d54 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -983,6 +983,7 @@ def capsys(request: SubRequest) -> Generator[CaptureFixture[str], None, None]: Returns an instance of :class:`CaptureFixture[str] `. Example: + .. code-block:: python def test_output(capsys): @@ -1010,6 +1011,7 @@ def capsysbinary(request: SubRequest) -> Generator[CaptureFixture[bytes], None, Returns an instance of :class:`CaptureFixture[bytes] `. Example: + .. code-block:: python def test_output(capsysbinary): @@ -1037,6 +1039,7 @@ def capfd(request: SubRequest) -> Generator[CaptureFixture[str], None, None]: Returns an instance of :class:`CaptureFixture[str] `. Example: + .. code-block:: python def test_system_echo(capfd): @@ -1064,6 +1067,7 @@ def capfdbinary(request: SubRequest) -> Generator[CaptureFixture[bytes], None, N Returns an instance of :class:`CaptureFixture[bytes] `. Example: + .. code-block:: python def test_system_echo(capfdbinary): diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 287fac463..058aaa1ff 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1735,6 +1735,7 @@ class Config: can be used to explicitly use the global verbosity level. Example: + .. code-block:: ini # content of pytest.ini diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 3f398df76..f498d60df 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -142,6 +142,7 @@ class MonkeyPatch: which undoes any patching done inside the ``with`` block upon exit. Example: + .. code-block:: python import functools diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index f9ab007a4..42f50900a 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -805,6 +805,7 @@ class Pytester: The first created file. Examples: + .. code-block:: python pytester.makefile(".txt", "line1", "line2") @@ -858,6 +859,7 @@ class Pytester: existing files. Examples: + .. code-block:: python def test_something(pytester): @@ -877,6 +879,7 @@ class Pytester: existing files. Examples: + .. code-block:: python def test_something(pytester):