Skip to content

Commit 05c145c

Browse files
committed
fix last? failing test
1 parent 95b2fdf commit 05c145c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/system/small/test_pandas_options.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ def test_credentials_need_reauthentication(
280280
session = bpd.get_global_session()
281281
assert session.bqclient._http.credentials.valid
282282

283+
# We look at the thread-local session because of the
284+
# reset_default_session_and_location fixture and that this test mutates
285+
# state that might otherwise be used by tests running in parallel.
286+
current_session = (
287+
bigframes.core.global_session._global_session_state.thread_local_session
288+
)
289+
assert current_session is not None
290+
291+
# Force a temp table to be created, so there is something to cleanup.
292+
current_session._anon_dataset_manager.create_temp_table(schema=())
293+
283294
with monkeypatch.context() as m:
284295
# Simulate expired credentials to trigger the credential refresh flow
285296
m.setattr(
@@ -303,15 +314,6 @@ def test_credentials_need_reauthentication(
303314
with pytest.raises(google.auth.exceptions.RefreshError):
304315
bpd.read_gbq(test_query)
305316

306-
# Now verify that closing the session works We look at the
307-
# thread-local session because of the
308-
# reset_default_session_and_location fixture and that this test mutates
309-
# state that might otherwise be used by tests running in parallel.
310-
assert (
311-
bigframes.core.global_session._global_session_state.thread_local_session
312-
is not None
313-
)
314-
315317
with warnings.catch_warnings(record=True) as warned:
316318
bpd.close_session() # CleanupFailedWarning: can't clean up
317319

0 commit comments

Comments
 (0)