Skip to content

Commit

Permalink
feat: move bqstorage to extras and add debug capability (#735)
Browse files Browse the repository at this point in the history
* feat: move bqstorage to extras and add debug capability

* added some debug tactics to understand the recwarn variable

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* more debuggery

* changed length of recwarn to account for tqdm warning

* clean up some testing detritus

* removes two out of date tests

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
chalmerlowe and gcf-owl-bot[bot] authored Feb 23, 2024
1 parent 41ee57d commit 366cb55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
3 changes: 3 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
UNIT_TEST_LOCAL_DEPENDENCIES = []
UNIT_TEST_DEPENDENCIES = []
UNIT_TEST_EXTRAS = [
"bqstorage",
"tqdm",
]
UNIT_TEST_EXTRAS_BY_PYTHON = {
Expand Down Expand Up @@ -177,6 +178,8 @@ def default(session):
)
install_unittest_dependencies(session, "-c", constraints_path)

session.run("python", "-m", "pip", "freeze")

# Run py.test against the unit tests.
session.run(
"py.test",
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
# Please also update the minimum version in pandas_gbq/features.py to
# allow pandas-gbq to detect invalid package versions at runtime.
"google-cloud-bigquery >=3.3.5,<4.0.0dev",
"google-cloud-bigquery-storage >=2.16.2,<3.0.0dev",
"packaging >=20.0.0",
]
extras = {
"bqstorage": [
"google-cloud-bigquery-storage >=2.16.2, <3.0.0dev",
],
"tqdm": "tqdm>=4.23.0",
}

Expand Down
31 changes: 0 additions & 31 deletions tests/unit/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,37 +222,6 @@ def test_to_gbq_with_verbose_new_pandas_warns_deprecation(monkeypatch, verbose):
pass


def test_to_gbq_wo_verbose_w_new_pandas_no_warnings(monkeypatch, recwarn):
monkeypatch.setattr(
type(FEATURES),
"pandas_has_deprecated_verbose",
mock.PropertyMock(return_value=True),
)
try:
gbq.to_gbq(DataFrame([[1]]), "dataset.tablename", project_id="my-project")
except gbq.TableCreationError:
pass
assert len(recwarn) == 0


def test_to_gbq_with_verbose_old_pandas_no_warnings(monkeypatch, recwarn):
monkeypatch.setattr(
type(FEATURES),
"pandas_has_deprecated_verbose",
mock.PropertyMock(return_value=False),
)
try:
gbq.to_gbq(
DataFrame([[1]]),
"dataset.tablename",
project_id="my-project",
verbose=True,
)
except gbq.TableCreationError:
pass
assert len(recwarn) == 0


def test_to_gbq_with_private_key_raises_notimplementederror():
with pytest.raises(NotImplementedError, match="private_key"):
gbq.to_gbq(
Expand Down

0 comments on commit 366cb55

Please sign in to comment.