-
Notifications
You must be signed in to change notification settings - Fork 1.7k
BigQuery: 'test_bigquery_magic_w_maximum_bytes_billed_invalid' test uses real client. #8719
Copy link
Copy link
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.testingtype: processA process-related concern. May include testing, release, or the like.A process-related concern. May include testing, release, or the like.
Description
The unit test fails if there are no valid credentials in the environment:
______________ test_bigquery_magic_w_maximum_bytes_billed_invalid ______________
@pytest.mark.usefixtures("ipython_interactive")
def test_bigquery_magic_w_maximum_bytes_billed_invalid():
ip = IPython.get_ipython()
ip.extension_manager.load_extension("google.cloud.bigquery")
magics.context._project = None
sql = "SELECT 17 AS num"
with pytest.raises(ValueError):
> ip.run_cell_magic("bigquery", "--maximum_bytes_billed=abc", sql)
tests/unit/test_magics.py:565:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.nox/unit-3-6/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2358: in run_cell_magic
result = fn(*args, **kwargs)
google/cloud/bigquery/magics.py:400: in _cell_magic
default_query_job_config=context.default_query_job_config,
google/cloud/bigquery/client.py:167: in __init__
project=project, credentials=credentials, _http=_http
../core/google/cloud/client.py:226: in __init__
_ClientProjectMixin.__init__(self, project=project)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <google.cloud.bigquery.client.Client object at 0x7f4bb6739d68>
project = None
def __init__(self, project=None):
project = self._determine_default(project)
if project is None:
raise EnvironmentError(
> "Project was not passed and could not be "
"determined from the environment."
)
E OSError: Project was not passed and could not be determined from the environment.We want unit tests to run in complete isolation from any possibility of triggering real API requests. This test actually expects to run a real query, which means it is a system test.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.testingtype: processA process-related concern. May include testing, release, or the like.A process-related concern. May include testing, release, or the like.