diff --git a/google/cloud/firestore_v1/base_client.py b/google/cloud/firestore_v1/base_client.py index f532ec1b7..7b9b22867 100644 --- a/google/cloud/firestore_v1/base_client.py +++ b/google/cloud/firestore_v1/base_client.py @@ -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 @@ -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, diff --git a/noxfile.py b/noxfile.py index 0f7922364..567f6bda2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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. @@ -98,6 +99,7 @@ def default(session): *session.posargs, ) + @nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" diff --git a/tests/unit/v1/test_base_client.py b/tests/unit/v1/test_base_client.py index 631733e07..163ea33e7 100644 --- a/tests/unit/v1/test_base_client.py +++ b/tests/unit/v1/test_base_client.py @@ -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 @@ -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)