-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.testingtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
When running the full nox
suite, tripped over these errors in the unit_grpc_gcp
sessions:
_____________ TestSpannerClient.test_client_with_grpc_gcp_channel ______________
self = <test_spanner_client_v1.TestSpannerClient object at 0x7f557d8ea668>
grpc_gcp_secure_channel = <MagicMock name='secure_channel' id='140005155447752'>
api_config = <MagicMock name='ApiConfig' id='140005155467504'>
merge = <MagicMock name='Merge' id='140005155827784'>
auth_default = <MagicMock name='default' id='140005155256136'>
@pytest.mark.skipif(not spanner_v1.HAS_GRPC_GCP,
reason='grpc_gcp module not available')
@mock.patch(
'google.auth.default',
return_value=(mock.sentinel.credentials, mock.sentinel.projet))
@mock.patch('google.protobuf.text_format.Merge')
@mock.patch('grpc_gcp.proto.grpc_gcp_pb2.ApiConfig',
return_value=mock.sentinel.api_config)
@mock.patch('grpc_gcp.secure_channel')
def test_client_with_grpc_gcp_channel(self,
grpc_gcp_secure_channel,
api_config,
merge,
auth_default):
spanner_target = 'spanner.googleapis.com:443'
client = spanner_v1.SpannerClient()
merge.assert_called_once_with(mock.ANY, mock.sentinel.api_config)
options = [('grpc_gcp.api_config', mock.sentinel.api_config)]
grpc_gcp_secure_channel.assert_called_once_with(
> spanner_target, mock.ANY, options=options)
tests/unit/gapic/v1/test_spanner_client_v1.py:578:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_mock_self = <MagicMock name='secure_channel' id='140005155447752'>
args = ('spanner.googleapis.com:443', <ANY>)
kwargs = {'options': [('grpc_gcp.api_config', sentinel.api_config)]}
self = <MagicMock name='secure_channel' id='140005155447752'>
msg = "Expected 'secure_channel' to be called once. Called 0 times."
def assert_called_once_with(_mock_self, *args, **kwargs):
"""assert that the mock was called exactly once and with the specified
arguments."""
self = _mock_self
if not self.call_count == 1:
msg = ("Expected '%s' to be called once. Called %s times." %
(self._mock_name or 'mock', self.call_count))
> raise AssertionError(msg)
E AssertionError: Expected 'secure_channel' to be called once. Called 0 times.
.nox/unit-grpc-gcp-3-7/lib/python3.7/site-packages/mock/mock.py:947: AssertionError
And a side note: there is really no purpose in running with grpcio-gcp
on all supported Pythons: we should trim it back to just 2.7 and 3.6.
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.testingtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.