pytest-dev / pytest-dev/pytest-django
No obvious way to set `self.maxDiff` with `pytest_django.asserts`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
When using pytest_django.asserts.assertXMLEqual, the diff in the console is truncated, with the following message at the end:
Diff is ### characters long. Set self.maxDiff to None to see it.
It's not obvious to me what the right way to accomplish this with pytest-django is, since the TestCase for these functions is defined internally. Right now I'm just monkeypatching unittest.case.TestCase.maxDiff, but it'd be nice to have an obvious way of doing this.
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 in pytest_django/asserts.py at the internally defined TestCase around lines 23–25, and trace how assertXMLEqual uses unittest's maxDiff. Review the issue discussion for the expected configuration approach. Done means users can control the diff limit through pytest-django without monkeypatching unittest.case.TestCase.maxDiff.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100