pytest-dev / pytest-dev/pytest
Set `__module__ = "pytest"` for all public class types?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
In #13804 I set the __module__ on some exception/enum types since it shows up in tracebacks. We also already set it on warning types.
I wonder if we should have a policy to set it for all types we expose? Or at least fixture types. The impetus is I was playing with subtests (#13738) and the failure looks like:
subtests = <_pytest.subtests.Subtests object at 0x7eff332f6900>
def test_it(subtests: pytest.Subtests) -> None:
for i in range(5):
with subtests.test(i=i):
> assert i % 2 == 0
E assert (1 % 2) == 0
y.py:9: AssertionError
That's our automatically showing repr of local variables. I figure it would be nicer to show pytest.Subtests here and in similar cases.
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
Review the existing exception, enum, and warning type changes from #13804, along with the subtests example in #13738. Inventory the public or fixture types affected and agree on the intended scope before changing anything. Done means the chosen public types display as pytest-qualified names in traceback local-variable representations, with coverage for the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100