From eb22abbcc2697f38d39eb21804d5a39d22aac7d7 Mon Sep 17 00:00:00 2001 From: michaelawyu Date: Fri, 3 Nov 2017 12:48:24 -0700 Subject: [PATCH] Fixed failed tests on Kokoro (Spanner + Translate) (#1192) * Fixed failed tests on Kokoro (Spanner + Translate) * Update quickstart_test.py --- spanner/cloud-client/quickstart_test.py | 6 ++---- spanner/cloud-client/snippets.py | 2 +- translate/cloud-client/snippets_test.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/spanner/cloud-client/quickstart_test.py b/spanner/cloud-client/quickstart_test.py index c2e42001b8d3..de2087250318 100644 --- a/spanner/cloud-client/quickstart_test.py +++ b/spanner/cloud-client/quickstart_test.py @@ -15,8 +15,6 @@ import os from google.cloud import spanner -import google.cloud.exceptions -import google.cloud.spanner.client import mock import pytest @@ -27,13 +25,13 @@ @pytest.fixture def patch_instance(): - original_instance = google.cloud.spanner.client.Client.instance + original_instance = spanner.Client.instance def new_instance(self, unused_instance_name): return original_instance(self, SPANNER_INSTANCE) instance_patch = mock.patch( - 'google.cloud.spanner.client.Client.instance', + 'google.cloud.spanner.Client.instance', side_effect=new_instance, autospec=True) diff --git a/spanner/cloud-client/snippets.py b/spanner/cloud-client/snippets.py index 61e5aff59509..380254ffad9f 100644 --- a/spanner/cloud-client/snippets.py +++ b/spanner/cloud-client/snippets.py @@ -194,7 +194,7 @@ def query_data_with_index( ALTER TABLE Albums ADD COLUMN MarketingBudget INT64 """ - from google.cloud.proto.spanner.v1 import type_pb2 + from google.cloud.spanner_v1.proto import type_pb2 spanner_client = spanner.Client() instance = spanner_client.instance(instance_id) diff --git a/translate/cloud-client/snippets_test.py b/translate/cloud-client/snippets_test.py index 153ee104a219..5123576698ad 100644 --- a/translate/cloud-client/snippets_test.py +++ b/translate/cloud-client/snippets_test.py @@ -46,4 +46,4 @@ def test_translate_utf8(capsys): text = u'나는 파인애플을 좋아한다.' snippets.translate_text('en', text) out, _ = capsys.readouterr() - assert u'I like pineapple.' in out + assert u'I like pineapples.' in out