Skip to content

Commit b2a5308

Browse files
committed
update magics by adding magics.context.project for several tests
1 parent 4e87993 commit b2a5308

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/unit/test_magics.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)