@@ -332,13 +332,7 @@ def test_executemany_delete_batch_autocommit(self):
332332
333333 sql = "DELETE FROM table WHERE col1 = %s"
334334
335- with mock .patch (
336- "google.cloud.spanner_v1.instance.Instance.exists" , return_value = True
337- ):
338- with mock .patch (
339- "google.cloud.spanner_v1.database.Database.exists" , return_value = True ,
340- ):
341- connection = connect ("test-instance" , "test-database" )
335+ connection = connect ("test-instance" , "test-database" )
342336
343337 connection .autocommit = True
344338 transaction = self ._transaction_mock ()
@@ -369,13 +363,7 @@ def test_executemany_update_batch_autocommit(self):
369363
370364 sql = "UPDATE table SET col1 = %s WHERE col2 = %s"
371365
372- with mock .patch (
373- "google.cloud.spanner_v1.instance.Instance.exists" , return_value = True
374- ):
375- with mock .patch (
376- "google.cloud.spanner_v1.database.Database.exists" , return_value = True ,
377- ):
378- connection = connect ("test-instance" , "test-database" )
366+ connection = connect ("test-instance" , "test-database" )
379367
380368 connection .autocommit = True
381369 transaction = self ._transaction_mock ()
@@ -418,13 +406,7 @@ def test_executemany_insert_batch_non_autocommit(self):
418406
419407 sql = """INSERT INTO table (col1, "col2", `col3`, `"col4"`) VALUES (%s, %s, %s, %s)"""
420408
421- with mock .patch (
422- "google.cloud.spanner_v1.instance.Instance.exists" , return_value = True
423- ):
424- with mock .patch (
425- "google.cloud.spanner_v1.database.Database.exists" , return_value = True ,
426- ):
427- connection = connect ("test-instance" , "test-database" )
409+ connection = connect ("test-instance" , "test-database" )
428410
429411 transaction = self ._transaction_mock ()
430412
@@ -461,13 +443,7 @@ def test_executemany_insert_batch_autocommit(self):
461443
462444 sql = """INSERT INTO table (col1, "col2", `col3`, `"col4"`) VALUES (%s, %s, %s, %s)"""
463445
464- with mock .patch (
465- "google.cloud.spanner_v1.instance.Instance.exists" , return_value = True
466- ):
467- with mock .patch (
468- "google.cloud.spanner_v1.database.Database.exists" , return_value = True ,
469- ):
470- connection = connect ("test-instance" , "test-database" )
446+ connection = connect ("test-instance" , "test-database" )
471447
472448 connection .autocommit = True
473449
@@ -510,13 +486,7 @@ def test_executemany_insert_batch_failed(self):
510486 sql = """INSERT INTO table (col1, "col2", `col3`, `"col4"`) VALUES (%s, %s, %s, %s)"""
511487 err_details = "Details here"
512488
513- with mock .patch (
514- "google.cloud.spanner_v1.instance.Instance.exists" , return_value = True
515- ):
516- with mock .patch (
517- "google.cloud.spanner_v1.database.Database.exists" , return_value = True ,
518- ):
519- connection = connect ("test-instance" , "test-database" )
489+ connection = connect ("test-instance" , "test-database" )
520490
521491 connection .autocommit = True
522492 cursor = connection .cursor ()
@@ -546,13 +516,7 @@ def test_executemany_insert_batch_aborted(self):
546516 sql = """INSERT INTO table (col1, "col2", `col3`, `"col4"`) VALUES (%s, %s, %s, %s)"""
547517 err_details = "Aborted details here"
548518
549- with mock .patch (
550- "google.cloud.spanner_v1.instance.Instance.exists" , return_value = True
551- ):
552- with mock .patch (
553- "google.cloud.spanner_v1.database.Database.exists" , return_value = True ,
554- ):
555- connection = connect ("test-instance" , "test-database" )
519+ connection = connect ("test-instance" , "test-database" )
556520
557521 transaction1 = mock .Mock (committed = False , rolled_back = False )
558522 transaction1 .batch_update = mock .Mock (
0 commit comments