Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions google/cloud/firestore_v1/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"""

import os
import grpc # type: ignore

import google.api_core.client_options # type: ignore
import google.api_core.path_template # type: ignore
Expand Down Expand Up @@ -147,9 +148,7 @@ def _firestore_api_helper(self, transport, client_class, client_module) -> Any:
# We need this in order to set appropriate keepalive options.

if self._emulator_host is not None:
# TODO(microgen): this likely needs to be adapted to use insecure_channel
# on new generated surface.
channel = transport.create_channel(host=self._emulator_host)
channel = grpc.insecure_channel(self._emulator_host)
else:
channel = transport.create_channel(
self._target,
Expand Down
6 changes: 4 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
BLACK_VERSION = "black==19.10b0"
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]

DEFAULT_PYTHON_VERSION = "3.9"
SYSTEM_TEST_PYTHON_VERSIONS = ["3.9"]
DEFAULT_PYTHON_VERSION = "3.8"
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]


@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
"""Run linters.
Expand Down Expand Up @@ -98,6 +99,7 @@ def default(session):
*session.posargs,
)


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/v1/test_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def test__firestore_api_property(self, mock_channel, mock_client):
return_value=mock.sentinel.firestore_api,
)
@mock.patch(
"google.cloud.firestore_v1.services.firestore.transports.grpc.FirestoreGrpcTransport.create_channel",
autospec=True,
"grpc.insecure_channel", autospec=True,
)
def test__firestore_api_property_with_emulator(
self, mock_insecure_channel, mock_client
Expand All @@ -83,7 +82,7 @@ def test__firestore_api_property_with_emulator(
self.assertIs(firestore_api, mock_client.return_value)
self.assertIs(firestore_api, client._firestore_api_internal)

mock_insecure_channel.assert_called_once_with(host=emulator_host)
mock_insecure_channel.assert_called_once_with(emulator_host)

# Call again to show that it is cached, but call count is still 1.
self.assertIs(client._firestore_api, mock_client.return_value)
Expand Down