pytest-dev / pytest-dev/pytest
asserrtrepr compare - use text diff for multiline reprs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
What's the problem this feature will solve?
when showing the diff for a multiline repr, all the lines are show as added/removes
Describe the solution you'd like
when repr is multiline use diff on it
Alternative Solutions
i'm locally delegating assertrepr_compare to use repr
from myapp import HostWrapper
def pytest_assertrepr_compare(config, op, left, right):
if isinstance(left, HostWrapper) and isinstance(right, HostWrapper) and op == "==":
res = config.hook.pytest_assertrepr_compare(config=config, op=op, left=repr(left), right=repr(right))
return res[0]
environment
still the case on pytest 6.2.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing pytest_assertrepr_compare and the comparison-reporting path for multiline repr values. Reproduce the behavior described in the issue on pytest 6.2.0 or the current code, then identify the existing text-diff behavior used for string comparisons. Done means multiline reprs produce a line-oriented diff instead of showing every line as added or removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100