Skip to content
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

Add pytest-clarity to test environment to improve error log output #1609

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

yubiuser
Copy link
Member

@yubiuser yubiuser commented Jul 1, 2024

We use pytest for testing. While it is very capable, its error output is a mess. Adding pytest-clarity improves on that (see https://github.com/darrenburns/pytest-clarity).

Before
Screenshot at 2024-07-01 00-10-02

After
Screenshot at 2024-07-01 00-09-46


Note: this PR needs 99f459e to pass the tests

@rdwebdesign
Copy link
Member

I really liked the new output, but since the intention is to improve the readability, I think we could use longer lines.

In my opinion, using the default width (80 characters) is creating too many line breaks in the output:

image

We already use line breaks (/n) where we need (and the github interface already prevents horizontal scrollbars).
We could have lines with 120 characters or any other width, adding the diff-width parameter here:

py.test -vv --diff-width=120 -n auto ./test/tests/

What do you think?

@PromoFaux
Copy link
Member

❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️

But also, what @rdwebdesign said.

@PromoFaux
Copy link
Member

Although it does not seem to make a difference.

Still 80 chars with new lines is better than no new lines at all, so I'll take it!

Before:
image

After:
image

@rdwebdesign
Copy link
Member

Well... the --diff-width parameter didn't work as I expected, but I was able to change the width using the COLUMNS environment variable:

COLUMNS=150 py.test -vv -n auto ./test/tests/

image

@yubiuser yubiuser merged commit a3633a1 into development-v6 Jul 2, 2024
7 checks passed
@yubiuser yubiuser deleted the pretty_fail branch July 2, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants