Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Sep 6, 2024
1 parent bc67b30 commit d44918d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions google/cloud/bigtable/data/_sync/cross_sync/cross_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class _Sync_Impl(metaclass=MappingMeta):
@classmethod
def Mock(cls, *args, **kwargs):
from unittest.mock import Mock

return Mock(*args, **kwargs)

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions tests/unit/data/_async/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

# try/except added for compatibility with python < 3.8
from unittest import mock

try:
from unittest.mock import AsyncMock # type: ignore
except ImportError: # pragma: NO COVER
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/data/_sync/test_cross_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import mock # type: ignore
from mock import AsyncMock # type: ignore


class TestCrossSync:
async def async_iter(self, in_list):
for i in in_list:
Expand Down Expand Up @@ -94,6 +95,7 @@ async def test_Mock(self, cs_sync, cs_async):
Test Mock class in both sync and async versions
"""
import unittest.mock

assert isinstance(cs_async.Mock(), AsyncMock)
assert isinstance(cs_sync.Mock(), unittest.mock.Mock)
# test with return value
Expand Down Expand Up @@ -390,7 +392,9 @@ async def test_create_task_async_passthrough(self, cs_async):
create_task.assert_called_once_with(coro_fn.return_value)
coro_fn.assert_called_once_with(*args, **kwargs)

@pytest.mark.skipif(sys.version_info < (3, 8), reason="Task names require python 3.8")
@pytest.mark.skipif(
sys.version_info < (3, 8), reason="Task names require python 3.8"
)
@pytest.mark.asyncio
async def test_create_task_async_with_name(self, cs_async):
"""
Expand Down

0 comments on commit d44918d

Please sign in to comment.