- Notifications
You must be signed in to change notification settings - Fork321
fix: broken create_job method#300
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bhtucker left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Since the root cause of this being broken for a while was the use of autospec mocks early in the test, I wonder if it's possible to mock something a bit further along so that the test still exercises the request marshalling. Seems like we should be able to at least have coverage throughto_api_repr of theJob created by this method.
| job_config | ||
| ) | ||
| destination=_get_sub_prop(job_config, ["copy","destinationTable"]) | ||
| destination=TableReference.from_api_repr(destination) |
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.
Would you like to guard this check withisinstance(TableReference, destination)?
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.
I mock further in test so now it coverto_api_repr. I am not sure about the guard to check instance becausejob_config is dict and as per the example it has values in the string format.
…into bigquery_issue_297
…into bigquery_issue_297
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
google/cloud/bigquery/job.py Outdated
| self._configuration._properties, ["copy","sourceTable"] | ||
| ) | ||
| ifsource_table: | ||
| _helpers._set_sub_prop( |
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.
No need for this logic. We can always set thesourceTables with only a single item, but if given a job resource that has onlysourceTable we need to be able to handle that.
Uh oh!
There was an error while loading.Please reload this page.
tests/unit/test_client.py Outdated
| withload_patchasclient_method,get_config_patch: | ||
| client.create_job(job_config=job_config) | ||
| client_method.assert_called_once() | ||
| if"copy"injob_config: |
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.
Ditto. I'm sure confused by this logic, but I think whatever it was meant to do is unnecessary after#323
tests/unit/test_client.py Outdated
| withload_patchasclient_method,get_config_patch: | ||
| client.create_job(job_config=job_config) | ||
| client_method.assert_called_once() | ||
| # if "copy" in job_config: |
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.
Is this commented out code needed?
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, my bad.
Uh oh!
There was an error while loading.Please reload this page.
| ) | ||
| elif"query"injob_config: | ||
| copy_config=copy.deepcopy(job_config) | ||
| _del_sub_prop(copy_config, ["query","destinationTable"]) |
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.
I didn't realize we were already removing this property in past releases. We should restore this, since I don't want to break existing clients.
Uh oh!
There was an error while loading.Please reload this page.
Fixes#297