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

Improve repr(Skipped): add __repr__ method and test coverage #13272

Closed

Conversation

Artem-Sarkisian
Copy link

This PR enhances the Skipped exception by implementing a repr method, ensuring a more informative and structured representation when debugging.

Changes:
• Implemented repr method for Skipped, improving its debuggability.
• Added a test to verify repr(Skipped(...)) output.
• Created a changelog entry (12647.improvement.rst) for better traceability.

Checklist:
• Added a test for the new behavior.
• Created a new changelog file (12647.improvement.rst).
• Updated documentation (not required for this change).
• Allow maintainers to squash and merge commits.

Closes #12647

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Mar 5, 2025
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does diverging from the common default for exceptions concretely enhance debugging

@Artem-Sarkisian
Copy link
Author

How does diverging from the common default for exceptions concretely enhance debugging

The issue #12647 was created to address the need for improving the debugging experience when working with skipped tests in pytest. The default behavior for Skipped exceptions in pytest did not provide enough detail about why a test was skipped, which led to difficulties in debugging and understanding the root cause of skipped tests. The change proposed in this PR—adding a custom repr method to the Skipped exception—was aimed at enhancing this situation by providing more informative and structured exception output.

By implementing this change, we ensure that debugging skipped tests is more efficient, as developers can now see the exact reason for a skip directly in the exception message. This improvement was directly motivated by the concerns raised in issue #12647 and addresses the usability of pytest in real-world scenarios.

@The-Compiler
Copy link
Member

I'm confused. The issue you mention (also as "Closes:" in the PR description, as well as in the changelog) seems to be entirely unrelated to what this PR does?

@Artem-Sarkisian Artem-Sarkisian deleted the add-callinfo-repr branch March 6, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Three tests fails with PYTEST_PLUGINS set to _hypothesis_pytestplugin
3 participants