What hooks can throw errors? #9251
Unanswered
brandon-leapyear
asked this question in
Q&A
Replies: 1 comment
-
Bumping this. I really want this functionality! |
Beta Was this translation helpful? Give feedback.
0 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.
-
The documentation states:
This makes sense, where "break the pytest run" means "prevent all tests from running". But it seems like excluding
pytest_runtest_*
hooks, there are two different kinds of hooks: hooks where thrown errors result in an "INTERNALERROR" and hooks where thrown errors result in a normal one-time "ERROR".For example, I'm trying to write a hook that runs after collecting all tests and throws an error if some condition fails. Throwing an exception in
pytest_collection_modifyitems
results inINTERNALERROR> Exception: ...
, whereas throwing an exception inpytest_generate_tests
results inERROR collecting test/test_foo.py
.pytest_collection_modifyitems
andpytest_generate_tests
have these differences in error handling guaranteed? i.e. if I throw an error inpytest_generate_tests
, will some future pytest version change it to an INTERNALERROR?pytest_generate_test
the correct location?Beta Was this translation helpful? Give feedback.
All reactions