Skip to content

Commit 3b57288

Browse files
committed
test(bigtable): only async-iterate streaming results in materialized view metadata test
read_row, row_exists, and the other non-streaming methods return concrete values; async-iterating them raised a TypeError that the surrounding except block silently swallowed, which could mask real errors.
1 parent d522528 commit 3b57288

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

packages/google-cloud-bigtable/tests/unit/data/_async/test_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,8 +1788,12 @@ async def test_call_metadata(self, include_app_profile, fn_name, fn_args, gapic_
17881788
view = self._make_one(client, app_profile_id=profile)
17891789
try:
17901790
test_fn = view.__getattribute__(fn_name)
1791-
maybe_stream = await test_fn(*fn_args)
1792-
[i async for i in maybe_stream]
1791+
result = await test_fn(*fn_args)
1792+
if fn_name == "read_rows_stream":
1793+
# only streams are async-iterable; the other methods return
1794+
# concrete values, and iterating them would raise a TypeError
1795+
# that the except block below hides
1796+
[i async for i in result]
17931797
except Exception:
17941798
# we expect an exception from attempting to call the mock
17951799
pass

packages/google-cloud-bigtable/tests/unit/data/_sync_autogen/test_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,8 +1477,9 @@ def test_call_metadata(self, include_app_profile, fn_name, fn_args, gapic_fn):
14771477
view = self._make_one(client, app_profile_id=profile)
14781478
try:
14791479
test_fn = view.__getattribute__(fn_name)
1480-
maybe_stream = test_fn(*fn_args)
1481-
[i for i in maybe_stream]
1480+
result = test_fn(*fn_args)
1481+
if fn_name == "read_rows_stream":
1482+
[i for i in result]
14821483
except Exception:
14831484
pass
14841485
assert rpc_mock.call_count == 1

0 commit comments

Comments
 (0)