File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments