Skip to content

Commit

Permalink
give larger time buffer for test
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Dec 5, 2024
1 parent 2f40ea2 commit 7365229
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/unit/data/_async/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ async def test_read_rows_sharded_negative_batch_timeout(self):
from google.api_core.exceptions import DeadlineExceeded

async def mock_call(*args, **kwargs):
await CrossSync.sleep(0.05)
await CrossSync.sleep(0.06)
return [mock.Mock()]

async with self._make_client() as client:
Expand All @@ -2019,11 +2019,11 @@ async def mock_call(*args, **kwargs):
num_calls = 15
queries = [ReadRowsQuery() for _ in range(num_calls)]
with pytest.raises(ShardedReadRowsExceptionGroup) as exc:
await table.read_rows_sharded(queries, operation_timeout=0.01)
await table.read_rows_sharded(queries, operation_timeout=0.05)
assert isinstance(exc.value, ShardedReadRowsExceptionGroup)
# _CONCURRENCY_LIMIT calls will run, and won't be interrupted
# calls after the limit will be cancelled due to timeout
assert len(exc.value.exceptions) >= num_calls - _CONCURRENCY_LIMIT
assert len(exc.value.exceptions) == num_calls - _CONCURRENCY_LIMIT
assert all(
isinstance(e.__cause__, DeadlineExceeded)
for e in exc.value.exceptions
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/data/_sync_autogen/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@ def test_read_rows_sharded_negative_batch_timeout(self):
from google.api_core.exceptions import DeadlineExceeded

def mock_call(*args, **kwargs):
CrossSync._Sync_Impl.sleep(0.05)
CrossSync._Sync_Impl.sleep(0.06)
return [mock.Mock()]

with self._make_client() as client:
Expand All @@ -1679,7 +1679,7 @@ def mock_call(*args, **kwargs):
num_calls = 15
queries = [ReadRowsQuery() for _ in range(num_calls)]
with pytest.raises(ShardedReadRowsExceptionGroup) as exc:
table.read_rows_sharded(queries, operation_timeout=0.01)
table.read_rows_sharded(queries, operation_timeout=0.05)
assert isinstance(exc.value, ShardedReadRowsExceptionGroup)
assert len(exc.value.exceptions) >= num_calls - _CONCURRENCY_LIMIT
assert all(
Expand Down

0 comments on commit 7365229

Please sign in to comment.