From b400718614021a17987b9d0ccf125a547a7af743 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Fri, 29 Nov 2024 09:58:55 -0800 Subject: [PATCH] Fix lint --- google/cloud/spanner_v1/pool.py | 6 +++--- tests/unit/test_pool.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/google/cloud/spanner_v1/pool.py b/google/cloud/spanner_v1/pool.py index 163b73402a..54d2b04314 100644 --- a/google/cloud/spanner_v1/pool.py +++ b/google/cloud/spanner_v1/pool.py @@ -388,7 +388,7 @@ def get(self): span_event_attributes, ) session = self._sessions.get_nowait() - except queue.Empty as e: + except queue.Empty: add_span_event( current_span, "No sessions available in pool. Creating session", @@ -510,8 +510,9 @@ def bind(self, database): session_count=self.size - created_session_count, session_template=Session(creator_role=self.database_role), ) - span_event_attributes = {"kind": type(self).__name__} + span_event_attributes = {"kind": type(self).__name__} + current_span = get_current_span() requested_session_count = request.session_count if requested_session_count <= 0: add_span_event( @@ -521,7 +522,6 @@ def bind(self, database): ) return - current_span = get_current_span() add_span_event( current_span, f"Requesting {requested_session_count} sessions", diff --git a/tests/unit/test_pool.py b/tests/unit/test_pool.py index ee5cb766bf..e8e4e75fbf 100644 --- a/tests/unit/test_pool.py +++ b/tests/unit/test_pool.py @@ -248,12 +248,12 @@ def test_spans_bind_get_empty_pool(self): pool = self._make_one(size=0) database = _Database("name") session1 = _Session(database) - with trace_call("pool.Get", session1) as span: + with trace_call("pool.Get", session1): try: pool.bind(database) database._sessions = database._sessions[:0] pool.get() - except: + except Exception: pass wantEventNames = [