Can pytest show all arguments of exception that unintentionally occured?
See original GitHub issueI have got Exception class looking like that:
class MutationValidationError(ValidationError):
def __init__(self, error_dict=None):
if error_dict is None:
error_dict = ErrorDict()
self.error_dict = error_dict
super().__init__(msg='Failed to run mutation')
This Error is raised during test in a place where it shouldn’t. But for purpose of debugging it is crucial for me to see the contents of error_dict. Unfortunatelly it isn’t visible in test output. Can I make it visible without using try…catch clause?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
API Reference — pytest documentation
PathLike[str]]]) – List of command line arguments. ... Use pytest.raises as a context manager, which will capture the exception of the given type:....
Read more >How to properly assert that an exception gets raised in pytest?
Using pytest.raises is likely to be better for cases where you are testing exceptions your own code is deliberately raising, whereas using @ ......
Read more >Confusion between message and match parameters in pytest ...
After analyzing several code bases, it appears there is frequent confusion by users between the match and message parameters in ...
Read more >pytest Documentation - Read the Docs
pytest will run all files of the form test_*.py or *_test.py in the ... pytest --fixtures # show available builtin function arguments.
Read more >pytest: testing exceptions (beginner - intermediate) anthony ...
today I talk about how to test exceptions in pytest ! ... If you have any suggestions or things you'd like to see...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
oh I see, didn’t notice you were overriding
__str__
(which would hide the value there)Thanks @asottile. Without str all arguments of Exception are visible.