Skip to content
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

Adds _connection object to bigquery magics context. #8192

Merged
merged 4 commits into from
May 31, 2019

Conversation

vimota
Copy link
Contributor

@vimota vimota commented May 30, 2019

As recommended by: #8024 (comment).

@vimota vimota requested a review from a team May 30, 2019 02:51
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 30, 2019
@sduskis sduskis requested review from tswast and removed request for a team May 30, 2019 17:00
@vimota
Copy link
Contributor Author

vimota commented May 30, 2019

This is the output of nox:

nox > Session docs was successful.
nox > Ran multiple sessions:
nox > * unit-2.7: success
nox > * unit-3.5: skipped
nox > * unit-3.6: success
nox > * unit-3.7: success
nox > * system-2.7: success
nox > * system-3.6: success
nox > * snippets-2.7: success
nox > * snippets-3.6: success
nox > * cover: failed
nox > * lint: success
nox > * lint_setup_py: success
nox > * blacken: success
nox > * docs: success

Looks good except for coverage, which has this table:

Name                                        Stmts   Miss Branch BrPart  Cover   Missing
---------------------------------------------------------------------------------------
google/cloud/bigquery/__init__.py              49      0      0      0   100%
google/cloud/bigquery/_helpers.py             219      0    112      0   100%
google/cloud/bigquery/_http.py                 12      0      0      0   100%
google/cloud/bigquery/client.py               468      0    192      0   100%
google/cloud/bigquery/dataset.py              193      0     57      0   100%
google/cloud/bigquery/dbapi/__init__.py        30      0      0      0   100%
google/cloud/bigquery/dbapi/_helpers.py        42      0     26      0   100%
google/cloud/bigquery/dbapi/connection.py      14      0      2      0   100%
google/cloud/bigquery/dbapi/cursor.py         107      0     30      0   100%
google/cloud/bigquery/dbapi/exceptions.py      11      0      0      0   100%
google/cloud/bigquery/dbapi/types.py           22      0      0      0   100%
google/cloud/bigquery/external_config.py      213      0     28      0   100%
google/cloud/bigquery/job.py                 1008      0    207      0   100%
google/cloud/bigquery/magics.py                85      0     16      1    99%   367->369
google/cloud/bigquery/model.py                118      0     20      0   100%
google/cloud/bigquery/query.py                215      0     70      0   100%
google/cloud/bigquery/retry.py                 13      0      4      0   100%
google/cloud/bigquery/schema.py                54      0     14      0   100%
google/cloud/bigquery/table.py                654      0    229      0   100%
tests/unit/__init__.py                          0      0      0      0   100%
tests/unit/model/__init__.py                    0      0      0      0   100%
tests/unit/model/test_model.py                112      0      0      0   100%
tests/unit/model/test_model_reference.py       71      0      0      0   100%
tests/unit/test__helpers.py                   605      0      6      0   100%
tests/unit/test__http.py                       58      0      0      0   100%
tests/unit/test_client.py                    2305      0     60      0   100%
tests/unit/test_dataset.py                    455      0     18      0   100%
tests/unit/test_dbapi__helpers.py              44      0      6      0   100%
tests/unit/test_dbapi_connection.py            43      0      0      0   100%
tests/unit/test_dbapi_cursor.py               201      0      4      0   100%
tests/unit/test_dbapi_types.py                 18      0      0      0   100%
tests/unit/test_external_config.py            176      0      0      0   100%
tests/unit/test_job.py                       3027      0    126      0   100%
tests/unit/test_magics.py                     298      0      4      0   100%
tests/unit/test_query.py                      611      0      4      0   100%
tests/unit/test_retry.py                       38      0      0      0   100%
tests/unit/test_schema.py                     223      0      2      0   100%
tests/unit/test_table.py                     1472      0     70      0   100%
---------------------------------------------------------------------------------------
TOTAL                                       13284      0   1307      1    99%

I'm not totally sure how to increase coverage / what's missing, I thought the test I added pretty thoroughly tests the Connection object? Perhaps I need one that tests not setting it?

@tswast
Copy link
Contributor

tswast commented May 30, 2019

I'm not totally sure how to increase coverage / what's missing, I thought the test I added pretty thoroughly tests the Connection object? Perhaps I need one that tests not setting it?

Correct. That's saying we're missing the branch where _connection is not set.

@sduskis sduskis added the api: bigquery Issues related to the BigQuery API. label May 30, 2019
@@ -782,6 +782,17 @@ def _make_field(field_type, mode="NULLABLE", name="testing", fields=()):
return SchemaField(name=name, field_type=field_type, mode=mode, fields=fields)


def _make_connection(*responses):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is tests for _helpers, not helpers for tests. I'd recommend creating a separate tests/unit/helpers.py if you plan to do this refactoring.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks! I was wondering why the filename looked different...

@vimota
Copy link
Contributor Author

vimota commented May 31, 2019

I'm not totally sure how to increase coverage / what's missing, I thought the test I added pretty thoroughly tests the Connection object? Perhaps I need one that tests not setting it?

Correct. That's saying we're missing the branch where _connection is not set.

Done!

@tswast tswast added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 31, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 31, 2019
@tswast tswast merged commit 8d9d129 into googleapis:master May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants