Skip to content
14 changes: 9 additions & 5 deletions packages/google-cloud-bigquery/tests/system/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,16 @@ def _still_in_use(bad_request):
tag_key = key_values.pop()

# Delete tag values first
[
tag_values_client.delete_tag_value(name=tag_value.name).result()
for tag_value in key_values
]
for tag_value in key_values:
try:
tag_values_client.delete_tag_value(name=tag_value.name).result()
except NotFound:
pass

tag_keys_client.delete_tag_key(name=tag_key.name).result()
try:
tag_keys_client.delete_tag_key(name=tag_key.name).result()
except NotFound:
pass

def test_get_service_account_email(self):
client = Config.CLIENT
Expand Down
15 changes: 8 additions & 7 deletions packages/google-cloud-bigquery/tests/unit/test_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@

bigquery_storage = pytest.importorskip("google.cloud.bigquery_storage")
IPython = pytest.importorskip("IPython")
interactiveshell = pytest.importorskip("IPython.terminal.interactiveshell")
interactiveshell = pytest.importorskip("IPython.core.interactiveshell")
tools = pytest.importorskip("IPython.testing.tools")
io = pytest.importorskip("IPython.utils.io")
pandas = pytest.importorskip("pandas")


@pytest.fixture()
@pytest.fixture(autouse=True)
def use_local_magics_context(monkeypatch):
if magics is not None: # pragma: NO COVER
local_context = magics.Context()
Expand All @@ -58,8 +58,7 @@ def use_local_magics_context(monkeypatch):
@pytest.fixture(scope="session")
def ipython():
config = tools.default_config()
config.TerminalInteractiveShell.simple_prompt = True
shell = interactiveshell.TerminalInteractiveShell.instance(config=config)
shell = interactiveshell.InteractiveShell.instance(config=config)
return shell


Expand Down Expand Up @@ -143,10 +142,12 @@ def fail_if(name, globals, locals, fromlist, level):
}


def test_context_with_default_credentials():
"""When Application Default Credentials are set, the context credentials
will be created the first time it is called
def test_context_resolves_unset_credentials_and_project():
"""When context credentials and project are unset (None), accessing them
resolves them from Application Default Credentials.
"""
magics.context._credentials = None
magics.context._project = None
assert magics.context._credentials is None
assert magics.context._project is None

Expand Down
Loading