Configuration error handling in pytest plugins #10211
-
In the event that a pytest plugin realises that it has been misconfigured, is there a defacto way in which it should report that information to the user? For example, def pytest_collection_modifyitems(session, config, items):
some_setting = config.getini("some-setting")
if some_setting doesn't make sense:
# What should go here to either abort the test run or propagate into a meaningful warning? My initial instinct was just to raise an exception but doing so leads to a stacktrace being dumped with the prefix |
Beta Was this translation helpful? Give feedback.
Answered by
nicoddemus
Aug 12, 2022
Replies: 1 comment 1 reply
-
Try raising |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bwoodsend
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try raising
pytest.UsageError
, we catch this at the top level and produce a shorter message.