-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[RFC/WIP]: assert: use safeformat for display with -vv #6020
Conversation
TODO: - [ ] real plugin hook? - [ ] should handle other places where safeformat is used also, via args/options to the hook then likely. Ref: pytest-dev#3962 Ref: pytest-dev#5933
Keeping newlines can result in many lines:
Alternatively we could bump the width to something very big, so that it wraps the automatically (hopefully), or replace newlines from pformat with spaces. |
if util._reprdisplay is not None: | ||
return util._reprdisplay(obj) | ||
# XXX: happens/used with testing/test_assertion.py::TestImportHookInstallation::test_rewrite_assertions_pytester_plugin # noqa: E501 | ||
return _saferepr(obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required to pass this test: https://github.com/pytest-dev/pytest/pull/2212/files#diff-14ad89cac128f1dd3aaa927c656035b3
The change looks good, I would avoid adding a hook until we have real use cases for the hook other than the builtin implementation. |
pytest fails to handle `pytest.fail.Exception` when raised in `repr`. This changes pytest-django to raise `RuntimeError` instead. Ref: pytest-dev/pytest#6020 Fixes pytest-dev#713
Agreed. |
Yep, just needs at least a test and CHANGELOG. 👍 |
TODO:
real plugin hook?args/options to the hook then likely.
Ref: #3962
Ref: #5933