pytest-dev / pytest-dev/unittest2pytest
assertRaises with context should replace context.exception with context.value
Open
Nobody has claimed this yet.
enhancement
help wanted
wontfix
- Dominant language
- Python
- Stars
- 141
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
input
with self.assertRaises(Exception) as ctx:
sut()
self.assertIn("msg", str(ctx.exception))
expected output
with pytest.raises(Exception) as ctx:
sut()
assert "msg" in str(ctx.value)
Contributor guide
No contributing guide indexed for this repository
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 locating the rewrite handling assertRaises context managers and the conversion of context.exception. Use the input and expected output in this issue as the acceptance case, and verify that the resulting pytest assertion uses context.value while preserving the message check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100