def test__make_bqstorage_client_true_missing_gapic(missing_grpcio_lib): credentials_mock = mock.create_autospec( google.auth.credentials.Credentials, instance=True) with pytest.raises(ImportError) as exc_context, missing_grpcio_lib: magics._make_bqstorage_client(True, credentials_mock) assert "grpcio" in str(exc_context.value)
def test__make_bqstorage_client_true_raises_import_error(monkeypatch): monkeypatch.setattr(magics, "bigquery_storage_v1beta1", None) credentials_mock = mock.create_autospec( google.auth.credentials.Credentials, instance=True) with pytest.raises(ImportError) as exc: magics._make_bqstorage_client(True, credentials_mock) assert "google-cloud-bigquery-storage" in str(exc)
def test__make_bqstorage_client_true_raises_import_error(missing_bq_storage): credentials_mock = mock.create_autospec( google.auth.credentials.Credentials, instance=True) with pytest.raises(ImportError) as exc_context, missing_bq_storage: magics._make_bqstorage_client(True, credentials_mock) error_msg = str(exc_context.value) assert "google-cloud-bigquery-storage" in error_msg assert "pyarrow" in error_msg
def test__make_bqstorage_client_true_raises_import_error(monkeypatch): monkeypatch.setattr(magics, "bigquery_storage_v1beta1", None) credentials_mock = mock.create_autospec( google.auth.credentials.Credentials, instance=True ) with pytest.raises(ImportError) as exc: magics._make_bqstorage_client(True, credentials_mock) assert "google-cloud-bigquery-storage" in str(exc)
def test__make_bqstorage_client_true(): credentials_mock = mock.create_autospec( google.auth.credentials.Credentials, instance=True ) got = magics._make_bqstorage_client(True, credentials_mock) assert isinstance(got, bigquery_storage_v1beta1.BigQueryStorageClient)
def test__make_bqstorage_client_false(): credentials_mock = mock.create_autospec( google.auth.credentials.Credentials, instance=True ) got = magics._make_bqstorage_client(False, credentials_mock) assert got is None