-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fix bug 843531 - DPF: Access violation when DataSource is incorrectly constructed #1146
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1146 +/- ##
==========================================
+ Coverage 87.32% 87.33% +0.01%
==========================================
Files 81 81
Lines 9221 9225 +4
==========================================
+ Hits 8052 8057 +5
+ Misses 1169 1168 -1 |
tests/test_datasources.py
Outdated
@@ -61,6 +61,9 @@ def test_print_data_sources(allkindofcomplexity, server_type): | |||
|
|||
|
|||
def test_data_sources_from_data_sources(allkindofcomplexity, server_type): | |||
with pytest.raises(ValueError) as e: | |||
data_sources_false = dpf.core.DataSources(data_sources="Wrong Input", server=server_type) | |||
assert "Data source must be gRPC data sources message type" in 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.
Minor: if I were you, I would just assert that "gRPC" data sources" substring is contained in the error message.
@@ -77,9 +78,12 @@ def __init__(self, result_path=None, data_sources=None, server=None): | |||
self._internal_obj = core_api.data_processing_duplicate_object_reference( | |||
data_sources | |||
) | |||
else: | |||
elif hasattr(data_sources, "DESCRIPTOR") or isinstance(data_sources, int): |
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.
You could also use if (hasattr(data_sources, "module") and (data_sources.module == 'data_sources_pb2'))
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.
Note: int is for the case CLayer server, ctypes.c_void_p is returned (which is an int)
No description provided.