Skip to content

Pytest documentation website issue: Python code example blocks not rendering properly in pytest documentation #12437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amittendulkar opened this issue Jun 7, 2024 · 3 comments · Fixed by #12449
Labels
type: bug problem that needs to be addressed type: docs documentation improvement, missing or needing clarification type: regression indicates a problem that was introduced in a release which was working previously

Comments

@amittendulkar
Copy link

When I refer to say https://docs.pytest.org/en/stable/reference/reference.html#capsys I see that the Python block example in it messed up. I tried with Edge, Firefox, Chrome and it looks broken in all 3.

The Python block seems to be rendering properly in 7.x documentation links and seemed to have broken from 8.x documentation links onward.

Sample (broken Python block) documentation for the stable version (8.2.2),
image

Sample (working) documentation for the 7.x version,
image

NOTE: Both screenshots are taken using Edge Version 125.0.2535.85 (Official build) (64-bit)

@bluetech
Copy link
Member

Thanks for letting us know, it must have broke when we switched to the Furo theme and we missed it.

@bluetech bluetech added type: bug problem that needs to be addressed type: docs documentation improvement, missing or needing clarification type: regression indicates a problem that was introduced in a release which was working previously labels Jun 10, 2024
@The-Compiler
Copy link
Member

I think this might actually have been the switch to ruff (4588653), which removed all the empty lines:

@@ -988,7 +987,6 @@ def capsys(request: SubRequest) -> Generator[CaptureFixture[str], None, None]:
     Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.
 
     Example:
-
     .. code-block:: python
 
         def test_output(capsys):
@@ -1016,7 +1014,6 @@ def capsysbinary(request: SubRequest) -> Generator[CaptureFixture[bytes], None,
     Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.
 
     Example:
-
     .. code-block:: python
 
         def test_output(capsysbinary):
@@ -1044,7 +1041,6 @@ def capfd(request: SubRequest) -> Generator[CaptureFixture[str], None, None]:
     Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.
 
     Example:
-
     .. code-block:: python
 
         def test_system_echo(capfd):
@@ -1072,7 +1068,6 @@ def capfdbinary(request: SubRequest) -> Generator[CaptureFixture[bytes], None, N
     Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.
 
     Example:
-
     .. code-block:: python
 
         def test_system_echo(capfdbinary):

I remember we had a PR fixing at least one of those, but can't find it. Maybe I'm misremembering and it was in a different project?

@bluetech
Copy link
Member

@The-Compiler thanks, this makes more sense. I will submit a fix.

bluetech added a commit to bluetech/pytest that referenced this issue Jun 11, 2024
Caused by 4588653. I disabled the
offending Ruff rule.

Fix pytest-dev#12437.
bluetech added a commit to bluetech/pytest that referenced this issue Jun 11, 2024
Caused by 4588653.

The issue was fixed in astral-sh/ruff#11577,
so won't trigger again.

Fix pytest-dev#12437.
nicoddemus pushed a commit that referenced this issue Jun 11, 2024
Caused by 4588653.

The issue was fixed in astral-sh/ruff#11577,
so won't trigger again.

Fix #12437.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed type: docs documentation improvement, missing or needing clarification type: regression indicates a problem that was introduced in a release which was working previously
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants