1717
1818import mock
1919from google .api_core import gapic_v1
20- from google .cloud .exceptions import NotFound
2120from google .cloud .spanner_v1 .param_types import INT64
2221from google .api_core .retry import Retry
2322
@@ -1793,7 +1792,6 @@ class Testing(Exception):
17931792 self .assertIs (pool ._session , session )
17941793
17951794 def test_context_mgr_session_not_found_error (self ):
1796- from google .cloud .spanner_v1 .database import SnapshotCheckout
17971795 from google .cloud .exceptions import NotFound
17981796
17991797 database = _Database (self .DATABASE_NAME )
@@ -1809,14 +1807,12 @@ def test_context_mgr_session_not_found_error(self):
18091807
18101808 self .assertEqual (pool ._session , session )
18111809 with self .assertRaises (NotFound ):
1812- with checkout as snapshot :
1813- raise NotFound (f "Session not found" )
1810+ with checkout as _ :
1811+ raise NotFound ("Session not found" )
18141812 # Assert that session-1 was removed from pool and new session was added.
18151813 self .assertEqual (pool ._session , new_session )
18161814
18171815 def test_context_mgr_unknown_error (self ):
1818- from google .cloud .spanner_v1 .database import SnapshotCheckout
1819-
18201816 database = _Database (self .DATABASE_NAME )
18211817 session = _Session (database )
18221818 pool = database ._pool = _Pool ()
@@ -1829,8 +1825,8 @@ class Testing(Exception):
18291825
18301826 self .assertEqual (pool ._session , session )
18311827 with self .assertRaises (Testing ):
1832- with checkout as snapshot :
1833- raise Testing (f"Session not found " )
1828+ with checkout as _ :
1829+ raise Testing ("Unknown error. " )
18341830 # Assert that session-1 was not removed from pool.
18351831 self .assertEqual (pool ._session , session )
18361832 pool ._new_session .assert_not_called ()
0 commit comments