Skip to content

Commit

Permalink
Fix python Cloud Spanner tests. [(#1548)](GoogleCloudPlatform/python-…
Browse files Browse the repository at this point in the history
…docs-samples#1548)

* Fix python Cloud Spanner tests.
* Lint.
  • Loading branch information
jsimonweb authored and kurtisvg committed Jun 29, 2018
1 parent 813f0a8 commit 07777ce
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions samples/samples/snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ def temporary_database(spanner_instance):
database_id = unique_database_id()
snippets.create_database(SPANNER_INSTANCE, database_id)
snippets.insert_data(SPANNER_INSTANCE, database_id)
snippets.write_struct_data(SPANNER_INSTANCE, database_id)
database = spanner_instance.database(database_id)
database.reload()
yield database
database.drop()


@pytest.fixture(scope='module')
def temporary_database_with_all_columns(spanner_instance):
database_id = unique_database_id()
snippets.create_database(SPANNER_INSTANCE, database_id)
snippets.insert_data(SPANNER_INSTANCE, database_id)
snippets.add_column(SPANNER_INSTANCE, database_id)
snippets.add_timestamp_column(SPANNER_INSTANCE, database_id)
database = spanner_instance.database(database_id)
database.reload()
yield database
Expand Down Expand Up @@ -213,10 +227,11 @@ def test_add_timestamp_column(temporary_database, capsys):


@pytest.mark.slow
def test_update_data_with_timestamp(temporary_database, capsys):
def test_update_data_with_timestamp(temporary_database_with_all_columns,
capsys):
snippets.update_data_with_timestamp(
SPANNER_INSTANCE,
temporary_database.database_id)
temporary_database_with_all_columns.database_id)

out, _ = capsys.readouterr()

Expand Down

0 comments on commit 07777ce

Please sign in to comment.