pytest-dev / pytest-dev/pytest
Generation of verbose assertion error with large bytearrays extremely slow
Open
Nobody has claimed this yet.
topic: rewrite
type: performance
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
pytest 5.2.4, python 3.7 linux
try this:
def test_foo():
assert b"\x00"*0xffff + b"\x01" == bytearray(0 for _ in range(0x10000))
pytest <...> -v will spend basically forever generating that error.
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 reproducing the supplied test with pytest 5.2.4 and a verbose run, then trace pytest's assertion explanation and representation handling for large bytes and bytearray values. The issue is resolved when this case no longer spends effectively forever generating its verbose assertion error, with focused regression coverage for the large-value comparison.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100