-
- Notifications
You must be signed in to change notification settings - Fork 2.9k
Resolving Issue #11666 #11700
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
Resolving Issue #11666 #11700
Conversation
for more information, see https://pre-commit.ci
| Thanks for working on this Tyler and Rowan!
Right, looks like I also noticed now that with the current pytest code, which uses However, Currently you are not doing |
Although the 'Terminal256Formatter' and 'TerminalTrueColorFormatter' do respect the style parameter, the value has to be a valid pygment style, and os.getenv("PYTEST_THEME") returns None. However, there are many pygment styles that can be used instead of a custom style ('abap', 'algol', 'algol_nu', 'arduino', 'autumn', 'bw', 'borland', 'colorful', 'default', 'dracula', 'emacs', 'friendly_grayscale', 'friendly', 'fruity', 'github-dark', 'gruvbox-dark', 'gruvbox-light', 'igor', 'inkpot', 'lightbulb', 'lilypond', 'lovelace', 'manni', 'material', 'monokai', 'murphy', 'native', 'nord-darker', 'nord', 'one-dark', 'paraiso-dark', 'paraiso-light', 'pastie', 'perldoc', 'rainbow_dash', 'rrt', 'sas', 'solarized-dark', 'solarized-light', 'staroffice', 'stata-dark', 'stata-light', 'tango', 'trac', 'vim', 'vs', 'xcode', 'zenburn'). We can update it to one of these stylings by writing something like, style = 'github-dark', style = os.getenv('PYTEST_THEME_MODE', 'github-dark'), or style = os.getenv('PYTEST_THEME', 'github-dark'). All of these lines have the same result because for some reason os.getenv('PYTEST_THEME') and os.getenv('PYTEST_THEME_MODE') both seem to have no effect. |
| In order for terminal_formatter = TerminalTrueColorFormatter( style=os.getenv("PYTEST_THEME"), ) |
When I pass style=os.getenv("PYTEST_THEME") into the TerminalTrueColorFormatter and Terminal256Formatter it returns "TypeError: 'NoneType' object is not iterable" as an error because os.getenv("PYTEST_THEME") returns None. |
Hmm right, it doesn't accept I'm not sure why it's not working for you, I suggest you push the change and I can check. |
| I'm going to close this in case anyone else wants to work on it, but let me know if you come back to it. |
Hello,
This PR resolves #11666.
Description:
Pytest is currently using the TerminalFormatter class from the Pygments library as the application’s universal terminal formatter. This issue focuses on using newer terminal formatters from Pygments which would improve the richness of color and the styling quality.Solution:
We addressed the issue by implementing the Terminal256Formatter and the TerminalTrueColorFormatter classes, and selected one of the three formatters based on the user’s operating system capabilities.Since the dark styling used in the TerminalFormatter class is not an option for either of the new formatters, we also created a new styling to closely match the dark Pytest design.
This gives us the following results:
Information
Head-fork: tyyan03/pytest compare: issue11666base-fork: pytest-dev/pytest
base: main
Thanks,
Tyler and Rowan