Skip to content

Commit

Permalink
run linter and update unit test mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Nov 19, 2024
1 parent 5f3a456 commit 7c4388f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion dbt/adapters/bigquery/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def create_dataproc_job_controller_client(credentials: BigQueryCredentials) -> J


@Retry() # google decorator. retries on transient errors with exponential backoff
def create_dataproc_batch_controller_client(credentials: BigQueryCredentials) -> BatchControllerClient:
def create_dataproc_batch_controller_client(
credentials: BigQueryCredentials,
) -> BatchControllerClient:
return BatchControllerClient(
credentials=create_google_credentials(credentials),
client_options=ClientOptions(api_endpoint=_dataproc_endpoint(credentials)),
Expand Down
4 changes: 3 additions & 1 deletion dbt/adapters/bigquery/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def create_job_execution_timeout(self, fallback: Optional[float] = None) -> Opti
def create_retry(
self, timeout: Optional[float] = None, fallback_timeout: Optional[float] = None
) -> Retry:
return DEFAULT_RETRY.with_timeout(timeout or self.create_job_execution_timeout(fallback_timeout))
return DEFAULT_RETRY.with_timeout(
timeout or self.create_job_execution_timeout(fallback_timeout)
)

def create_polling(
self, timeout: Optional[float] = None, fallback_timeout: Optional[float] = None
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_bigquery_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def get_adapter(self, target) -> BigQueryAdapter:

class TestBigQueryAdapterAcquire(BaseTestBigQueryAdapter):
@patch(
"dbt.adapters.bigquery.credentials._bigquery_defaults",
"dbt.adapters.bigquery.credentials._create_bigquery_defaults",
return_value=("credentials", "project_id"),
)
@patch("dbt.adapters.bigquery.BigQueryConnectionManager.open", return_value=_bq_conn())
Expand Down Expand Up @@ -244,7 +244,7 @@ def test_acquire_connection_oauth_validations(self, mock_open_connection):
mock_open_connection.assert_called_once()

@patch(
"dbt.adapters.bigquery.credentials._bigquery_defaults",
"dbt.adapters.bigquery.credentials._create_bigquery_defaults",
return_value=("credentials", "project_id"),
)
@patch(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_bigquery_connection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def setUp(self):
self.connections.get_thread_connection = lambda: self.mock_connection

@patch(
"dbt.adapters.bigquery.retry.bigquery_client",
"dbt.adapters.bigquery.retry.create_bigquery_client",
return_value=Mock(google.cloud.bigquery.Client),
)
def test_retry_connection_reset(self, mock_client_factory):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_configure_dataproc_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# parsed credentials
class TestConfigureDataprocBatch(BaseTestBigQueryAdapter):
@patch(
"dbt.adapters.bigquery.credentials._bigquery_defaults",
"dbt.adapters.bigquery.credentials._create_bigquery_defaults",
return_value=("credentials", "project_id"),
)
def test_update_dataproc_serverless_batch(self, mock_get_bigquery_defaults):
Expand Down Expand Up @@ -64,7 +64,7 @@ def to_str_values(d):
)

@patch(
"dbt.adapters.bigquery.credentials._bigquery_defaults",
"dbt.adapters.bigquery.credentials._create_bigquery_defaults",
return_value=("credentials", "project_id"),
)
def test_default_dataproc_serverless_batch(self, mock_get_bigquery_defaults):
Expand Down

0 comments on commit 7c4388f

Please sign in to comment.