how to flag a test case as failed when the code under test raises an exception? #11248
Unanswered
Coder2023Coder
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Beta Was this translation helpful? Give feedback.
2 replies
-
Can you show the exact output/behavior you get instead of describing it, and maybe show some of the related code too? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am testing several Python code snippets by pytest. One of the code snippets under test uses a built-in function from a Python library without importing the related library. When the testing process reaches the mentioned code, "NameError" is raised, and the whole testing is stopped. How should I take care of such cases in pytest so that pytest flags the tests related to that program as failed and continues testing the rest of the code snippets without termination? I am looking for a solution that deals with any kind of exception being raised like above.
I am using the following setup:
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions