pytest
pytest copied to clipboard
Let `OutcomeException` inherit from `Exception` instead of `BaseException`
What's the problem this feature will solve?
This allows for the usual handling and follows the Python documentation.
Describe the solution you'd like
Replace inheritance of OutcomeException from BaseException with Exception
Alternative Solutions
I can rewrite the code to expect a BaseException, but it does not follow Pythons recommend practice of inheriting user defined exceptions from Exception
Additional context
I'm curious to learn what the motivation is for inheriting from BaseException instead of Exception.
-10 on this
its a BaseException cause people like to catch `Exception without handling proper Passover for the outcomes
a user is NOT supposed to catch those without re-raising
most users easily do so by accident thus breaking the intended function
Hi @RonnyPfannschmidt , thank you for your answer.
If I understand correctly, usage has shown that people catch exceptions in their tests using the bare Exception?
In any case, could the docstring of the OutcomeException be updated explaining the choice for inheriting from the BaseException? The motivation is not clear for me when reading the code
Added a clarifying note would be great