pytest-dev / pytest-dev/pytest

Allow disabling aggregation of warnings by filename

Open
#14,983 2 comments 0 reactions 0 assignees View on GitHub

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?

Currently, when tests raise 10 or more warnings in total, the warnings are aggregated to display only the filenames they come from, without test ids.

https://github.com/pytest-dev/pytest/blob/431f3e1f5fd70b9b0f8afa2d20a10421542e5c6a/src/_pytest/terminal.py#L1126-L1135

This is counterproductive when we actually have a lot of warnings to fix in the code, because we don't know which tests / fragments of code raise them.

Describe the solution you'd like

A configuration setting to change the currently hardcoded limit (10) or disable it.

Alternative Solutions

A possible workaround is to use asserts instead of warnings.

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

Start with src/_pytest/terminal.py at lines 1126-1135, where warnings are aggregated after the hardcoded limit is reached. Trace the existing configuration path and warning-output behavior, then define completion as allowing the limit to be configured or disabled while preserving the current default and showing test ids when aggregation is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.