-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BEAM-14374] Fix module import error in FullyQualifiedNamedTransform #17482
Conversation
R: @robertwb |
Codecov Report
@@ Coverage Diff @@
## master #17482 +/- ##
==========================================
+ Coverage 73.93% 74.02% +0.09%
==========================================
Files 689 691 +2
Lines 90397 90873 +476
==========================================
+ Hits 66832 67266 +434
- Misses 22381 22423 +42
Partials 1184 1184
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Can you add a test?
@robertwb added a test |
@@ -116,6 +119,14 @@ def test_glob_filter(self): | |||
with self.assertRaises(ValueError): | |||
FullyQualifiedNamedTransform._resolve('apache_beam.Row') | |||
|
|||
@patch('importlib.import_module') | |||
def test_resolve(self, mock_import_module): |
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.
Sorry to be a stickler, but this mocking doesn't actually convince me that the code in question actually does the right thing. Could you actually perform an import here so that we know we're interacting with the import module in the right way?
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.
Other tests already cover some real importing but I added two more that would have failed without the change in this PR.
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.
Perfect. Thanks!
The second argument of
import_module
is ignored when the first argument is not a relative name. For example, the current implementation works forio
module sinceimport_module('io')
also works however it doesn't work forapache_beam.dataframe
sinceimport_module('dataframe')
also doesn't work.Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.