unittest: tearDown is not called if asyncSetUp fails
Open
Nobody has claimed this yet.
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
In unittest.TestCase, tearDown() is always called if setUp() is successful. It is only not called when setUp() fails. In IsolatedAsyncioTestCase, which is a subclass of TestCase, tearDown() is not called if setUp() is successful, but asyncSetUp() fails. I think is a problem.
Linked PRs
- gh-99596
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 comparing the unittest.TestCase setup and teardown lifecycle with IsolatedAsyncioTestCase, focusing on what happens when asyncSetUp() fails. Check the work referenced by linked PR gh-99596; done should include teardown after successful setUp() followed by a failed asyncSetUp(), with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100