-
Notifications
You must be signed in to change notification settings - Fork 10
RD-4296 - mimic AWS import strategy of the original handler #175
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
RD-4296 - mimic AWS import strategy of the original handler #175
Conversation
Codecov Report
@@ Coverage Diff @@
## master #175 +/- ##
==========================================
+ Coverage 96.21% 97.44% +1.22%
==========================================
Files 11 22 +11
Lines 952 1762 +810
==========================================
+ Hits 916 1717 +801
- Misses 36 45 +9 Continue to review full report at Codecov.
|
nirLumigo
left a comment
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 :)
| raise RuntimeError( | ||
| f"Invalid handler format: Bad handler '{os.environ[ORIGINAL_HANDLER_KEY]}': not enough values to unpack (expected 2, got 1)" | ||
| ) | ||
| ) from None |
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.
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.
| raise ImportError( | ||
| f"Unable to import module '{handler_module}': No module named '{handler_module}'" | ||
| ) | ||
| f"Runtime.ImportModuleError: Unable to import module '{handler_module}': {str(e)}" |
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.
Here you even add of original exception in the text. Don't you prefer to do from e instead?
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.
| def test_import_error(monkeypatch): | ||
| monkeypatch.setenv(ORIGINAL_HANDLER_KEY, "blabla.not.exists") | ||
|
|
||
| with pytest.raises(ImportError): |
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.
Why not do it with pytest.raises?
Same issue regarding the other tests in this file as well.
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.
That's a great question!
I did use pytest.raises in the first place, but then I noticed that it removes the context of the message, and I want to validate that there was no context (to follow AWS behavior!) :D
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.
Add a comment explaining why don't we use it
| def test_import_error(monkeypatch): | ||
| monkeypatch.setenv(ORIGINAL_HANDLER_KEY, "blabla.not.exists") | ||
|
|
||
| with pytest.raises(ImportError): |
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.
Add a comment explaining why don't we use it



No description provided.