[RFC/WIP]: assert: use safeformat for display with -vv#6020
[RFC/WIP]: assert: use safeformat for display with -vv#6020blueyed wants to merge 5 commits intopytest-dev:featuresfrom
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.
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