pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/pygments/pygments/pull/2996

"https://github.githubassets.com/assets/actions-0e714a98ea09295a.css" /> Add PytestSessionLexer to properly highlight pytest session output by emilymamcarz · Pull Request #2996 · pygments/pygments · GitHub
Skip to content

Add PytestSessionLexer to properly highlight pytest session output#2996

Open
emilymamcarz wants to merge 1 commit intopygments:masterfrom
emilymamcarz:fix-pytest-subtest-highlighting
Open

Add PytestSessionLexer to properly highlight pytest session output#2996
emilymamcarz wants to merge 1 commit intopygments:masterfrom
emilymamcarz:fix-pytest-subtest-highlighting

Conversation

@emilymamcarz
Copy link
Copy Markdown

Summary

This PR adds a dedicated PytestSessionLexer to Pygments to properly highlight pytest session output in documentation, examples, and testing outputs. Previously, the subtest lines in documentation were incorrectly highlighted, implying all subtests passed. This lexer fixes that while preserving existing highlighting for section headers, captured output, assertions, and tracebacks.

Details

PytestSessionLexer is a RegexLexer with:

  • Section header highlighting (==== FAILURES ====)
  • Subtest line highlighting (e.g., FAILED [100%] tests/test_file.py::TestClass::test_method[subtest x])
  • Captured stdout/stderr blocks
  • Assertion errors (E AssertionError)
  • File:line references (tests/test_file.py:14: AssertionError)
  • Fallback to Text for other lines
    The lexer is registered under the alias "pytest".

This PR resolves #2995

@birkenfeld birkenfeld added the new lexer PRs with wholly new lexers label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new lexer PRs with wholly new lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: Pytest Subtest Output Not Highlighted Correctly by Pygments Pytest Lexer

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy