Open graingert opened 5 years ago
or maybe you could cheat and output
with pytest.raises(Exception) as ctx:
sut()
ctx.exception = ctx.value # TODO: replace all uses of ctx.exception with ctx.value
assert "msg" in str(ctx.exception)
This would required static code analysis. I considert this as "won't fix", but will keep it open for the case someone else is eager to pick it up.
Might be worth updating pytest to provide a .exception property alias
@htgoebel I believe this is the smallest code change to fix this issue: https://github.com/pytest-dev/pytest/pull/5541
https://github.com/pytest-dev/unittest2pytest/blob/2c32cd693230d1b04de1d546d362d49fa891e7aa/README.rst#L78-L83 should probably be updated for when pytest-dev/pytest#5541 lands
I encountered this issue today. Did you consider emitting a warning when this condition is encountered?
input
expected output