File tree Expand file tree Collapse file tree
packages/bigframes/tests/unit/session Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,12 +182,18 @@ def test_user_agent_not_in_vscode(monkeypatch):
182182@mock .patch .dict (os .environ , {"VSCODE_PID" : "12345" }, clear = True )
183183def test_user_agent_in_vscode (monkeypatch ):
184184 monkeypatch_client_constructors (monkeypatch )
185- provider = create_clients_provider ()
186- assert_clients_w_user_agent (provider , "vscode" )
187- assert_clients_wo_user_agent (provider , "googlecloudtools.cloudcode" )
188185
189- # We still need to include attribution to bigframes
190- assert_clients_w_user_agent (provider , f"bigframes/{ bigframes .version .__version__ } " )
186+ with tempfile .TemporaryDirectory () as tmpdir :
187+ user_home = pathlib .Path (tmpdir )
188+ with mock .patch ("pathlib.Path.home" , return_value = user_home ):
189+ provider = create_clients_provider ()
190+ assert_clients_w_user_agent (provider , "vscode" )
191+ assert_clients_wo_user_agent (provider , "googlecloudtools.cloudcode" )
192+
193+ # We still need to include attribution to bigframes
194+ assert_clients_w_user_agent (
195+ provider , f"bigframes/{ bigframes .version .__version__ } "
196+ )
191197
192198
193199@mock .patch .dict (os .environ , {"VSCODE_PID" : "12345" }, clear = True )
You can’t perform that action at this time.
0 commit comments