-
Notifications
You must be signed in to change notification settings - Fork 408
Implement initial Dataset class #31
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
Conversation
* Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py
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.
Looks great! I really like how you used pytest fixtures for patching.
| if not source: | ||
| return dataset_obj | ||
|
|
||
| return dataset_obj.import_data( |
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.
This would return an LRO, while in the "no data import" case, we wait until the create_dataset LRO completes. We need to document clearly (e.g. in the docstring) this inconsistent behavior.
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.
Yeah these multiple LROs under-the-hood can be misleading to the user. I'm adding this discussion to b/171275584
| @pytest.fixture | ||
| def get_dataset_mock(self): | ||
| with patch.object(DatasetServiceClient, "get_dataset") as get_dataset_mock: | ||
| get_dataset_mock.return_value = GapicDataset( |
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.
this can become difficult to maintain to make sure the mocks return correct responses. we should look into replays.
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.
Captured in b/171334022
| reload(aip) | ||
|
|
||
| @pytest.fixture | ||
| def get_dataset_mock(self): |
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.
perhaps move the mock fixtures into conftest.py so they could be more easily reused.
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.
Captured in b/171333554
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
Summary of changes:
Datasetclass with following methods__init___create_importcreateimport_dataexport_dataDatasetclassutils.py—validate_idandvalidate_string_listprojectis not initialized or set in credentialsFixes b/169781839