pytest-dev / pytest-dev/pytest
Incomplete abstract class no longer logs an error
Open
Nobody has claimed this yet.
topic: collection
type: regression
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
We have this test in aiohttp:
def test_testcase_no_app(
testdir: pytest.Testdir, loop: asyncio.AbstractEventLoop
) -> None:
testdir.makepyfile(
"""
from aiohttp.test_utils import AioHTTPTestCase
class InvalidTestCase(AioHTTPTestCase):
def test_noop(self) -> None:
pass
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines(["*TypeError*"])
This has started failing sometime after 8.1.1.
The log seems to successfully run, rather than erroring.
Output from the test:
FAILED tests/test_test_utils.py::test_testcase_no_app - Failed: nomatch: '*TypeError*'
and: '============================= test session starts =============================='
and: 'platform darwin -- Python 3.11.9, pytest-8.4.1, pluggy-1.6.0'
and: 'codspeed: 3.2.0 (disabled, mode: walltime, timer_resolution: 41.7ns)'
and: 'rootdir: /private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_testcase_no_app0'
and: 'plugins: xdist-3.7.0, cov-6.2.1, mock-3.14.1, codspeed-3.2.0'
and: 'collected 0 items'
and: ''
and: '============================ no tests ran in 0.01s ============================='
remains unmatched: '*TypeError*'
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 with tests/test_test_utils.py and test_testcase_no_app, then inspect the testdir.runpytest entry point and the generated InvalidTestCase using AioHTTPTestCase. Reproduce the failure and trace why pytest collects zero tests without logging TypeError. Done means the test again observes the expected TypeError output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100