-
-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add engine_error()
context manager for testing plugin exceptions
#13108
Conversation
Co-authored-by: Christopher Neugebauer <_@chrisjrn.com> [ci skip-rust] [ci skip-build-wheels]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
# Conflicts: # src/python/pants/testutil/rule_runner.py # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it :)
Oh hm! @kaos your suggestion means we can make this a lot simpler. Do we really need to allow inspecting trap.e after the context manager? Instead, I think it's enough to rely on the expected_exception_type and contains args. That allows us to switch to a function-based context manager. |
Hah, true! :) |
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
EngineErrorTrap
for testing plugin exceptionsengine_error()
context manager for testing plugin exceptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool.
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
This makes it much easier to test that we raise the appropriate exceptions in rule code.
Thanks to @chrisjrn for co-developing this.
[ci skip-rust]
[ci skip-build-wheels]