@@ -985,7 +985,7 @@ def test_bigquery_magic_dryrun_option_sets_job_config(monkeypatch):
985985 magics .context .credentials = mock .create_autospec (
986986 google .auth .credentials .Credentials , instance = True
987987 )
988-
988+ magics . context . project = "project-from-context"
989989 run_query_patch = mock .patch (
990990 "google.cloud.bigquery.magics.magics._run_query" , autospec = True
991991 )
@@ -1007,6 +1007,7 @@ def test_bigquery_magic_dryrun_option_returns_query_job(monkeypatch):
10071007 magics .context .credentials = mock .create_autospec (
10081008 google .auth .credentials .Credentials , instance = True
10091009 )
1010+ magics .context .project = "project-from-context"
10101011 query_job_mock = mock .create_autospec (
10111012 google .cloud .bigquery .job .QueryJob , instance = True
10121013 )
@@ -1034,7 +1035,7 @@ def test_bigquery_magic_dryrun_option_variable_error_message(
10341035 magics .context .credentials = mock .create_autospec (
10351036 google .auth .credentials .Credentials , instance = True
10361037 )
1037-
1038+ magics . context . project = "project-from-context"
10381039 ipython_ns_cleanup .append ((ip , "q_job" ))
10391040
10401041 run_query_patch = mock .patch (
@@ -1064,6 +1065,7 @@ def test_bigquery_magic_dryrun_option_saves_query_job_to_variable(
10641065 magics .context .credentials = mock .create_autospec (
10651066 google .auth .credentials .Credentials , instance = True
10661067 )
1068+ magics .context .project = "project-from-context"
10671069 query_job_mock = mock .create_autospec (
10681070 google .cloud .bigquery .job .QueryJob , instance = True
10691071 )
@@ -1100,10 +1102,6 @@ def test_bigquery_magic_saves_query_job_to_variable_on_error(
11001102 mock .create_autospec (google .auth .credentials .Credentials , instance = True ),
11011103 )
11021104 magics .context .project = "project-from-context"
1103- # monkeypatch.setattr(magics.context, "project", "project-from-context")
1104- # magics.context.credentials = mock.create_autospec(
1105- # google.auth.credentials.Credentials, instance=True
1106- # )
11071105
11081106 ipython_ns_cleanup .append ((ip , "result" ))
11091107
0 commit comments