From 7fff88d0fec89d283b78618e1affffb7db40e6fe Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Tue, 4 Apr 2017 16:08:30 -0700 Subject: [PATCH] Remove cloud config fixture [(#887)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/887) * Remove cloud config fixture * Fix client secrets * Fix bigtable instance --- samples/snippets/async_query_test.py | 2 +- samples/snippets/export_data_to_gcs_test.py | 9 +++++---- samples/snippets/load_data_from_gcs_test.py | 8 +++++--- samples/snippets/sync_query_params_test.py | 4 ++-- samples/snippets/sync_query_test.py | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/samples/snippets/async_query_test.py b/samples/snippets/async_query_test.py index 810c538a6..85ce3fce9 100644 --- a/samples/snippets/async_query_test.py +++ b/samples/snippets/async_query_test.py @@ -15,7 +15,7 @@ from async_query import async_query -def test_async_query(cloud_config, capsys): +def test_async_query(capsys): query = ( 'SELECT corpus FROM `publicdata.samples.shakespeare` ' 'GROUP BY corpus;') diff --git a/samples/snippets/export_data_to_gcs_test.py b/samples/snippets/export_data_to_gcs_test.py index acbbe50e5..a41cfd226 100644 --- a/samples/snippets/export_data_to_gcs_test.py +++ b/samples/snippets/export_data_to_gcs_test.py @@ -11,19 +11,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import export_data_to_gcs +import os +import export_data_to_gcs +BUCKET = os.environ['CLOUD_STORAGE_BUCKET'] DATASET_ID = 'test_dataset' TABLE_ID = 'test_table' -def test_export_data_to_gcs(cloud_config, capsys): +def test_export_data_to_gcs(capsys): export_data_to_gcs.export_data_to_gcs( DATASET_ID, TABLE_ID, - 'gs://{}/test-export-data-to-gcs.csv'.format( - cloud_config.storage_bucket)) + 'gs://{}/test-export-data-to-gcs.csv'.format(BUCKET)) out, _ = capsys.readouterr() diff --git a/samples/snippets/load_data_from_gcs_test.py b/samples/snippets/load_data_from_gcs_test.py index 2d1c66162..dbd39fc5c 100644 --- a/samples/snippets/load_data_from_gcs_test.py +++ b/samples/snippets/load_data_from_gcs_test.py @@ -11,15 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + import load_data_from_gcs +BUCKET = os.environ['CLOUD_STORAGE_BUCKET'] DATASET_ID = 'test_dataset' TABLE_ID = 'test_import_table' -def test_load_table(cloud_config, capsys): - cloud_storage_input_uri = 'gs://{}/data.csv'.format( - cloud_config.storage_bucket) +def test_load_table(capsys): + cloud_storage_input_uri = 'gs://{}/data.csv'.format(BUCKET) load_data_from_gcs.load_data_from_gcs( DATASET_ID, diff --git a/samples/snippets/sync_query_params_test.py b/samples/snippets/sync_query_params_test.py index 270dfc62a..d87fe8231 100644 --- a/samples/snippets/sync_query_params_test.py +++ b/samples/snippets/sync_query_params_test.py @@ -15,7 +15,7 @@ import sync_query_params -def test_sync_query_named_params(cloud_config, capsys): +def test_sync_query_named_params(capsys): sync_query_params.sync_query_named_params( corpus='romeoandjuliet', min_word_count=100) @@ -23,7 +23,7 @@ def test_sync_query_named_params(cloud_config, capsys): assert 'love' in out -def test_sync_query_positional_params(cloud_config, capsys): +def test_sync_query_positional_params(capsys): sync_query_params.sync_query_positional_params( corpus='romeoandjuliet', min_word_count=100) diff --git a/samples/snippets/sync_query_test.py b/samples/snippets/sync_query_test.py index 6f6b4f5fa..26c8973e4 100644 --- a/samples/snippets/sync_query_test.py +++ b/samples/snippets/sync_query_test.py @@ -15,7 +15,7 @@ from sync_query import sync_query -def test_sync_query(cloud_config, capsys): +def test_sync_query(capsys): query = ( 'SELECT corpus FROM `publicdata.samples.shakespeare` ' 'GROUP BY corpus;')