pytest-dev / pytest-dev/pytest

assertion explanation cutoff takes beginnings of relevant lines for near identical contents

Open
#10,372 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: rewrite type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

  AssertionError: assert '[metadata]\n... = LICENSES\n' == '[metadata]\n... = LICENSES\n'
E         Skipping 38 identical leading characters in diff, use -v to show
E         - cense_file = LICENSE
E         - license_files = LICENSES
E         ? --
E         + cense_files = LICENSES

vs


E       AssertionError: assert '[metadata]\n... = LICENSES\n' == '[metadata]\n... = LICENSES\n'
E           [metadata]
E           name = pkg
E           version = 1.0
E         - license_file = LICENSE
E           license_files = LICENSES

with -v
we should enhance the heuristics so te diff doesn't turn out confusing

pytest 7.1.3
fedora 36

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported near-identical string assertion with pytest 7.1.3, comparing normal output with -v. Trace the assertion explanation and diff cutoff behavior from that reproduction; done means the shortened output preserves the relevant differing lines without the confusing truncation shown in the issue.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.