-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Do not attempt to load default credentials when `credential_prov…
…ider` is given (#19589)
- Loading branch information
1 parent
5053252
commit d75d8d9
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
|
||
import polars as pl | ||
from polars.exceptions import ComputeError | ||
|
||
|
||
def test_credential_provider_skips_config_autoload( | ||
monkeypatch: pytest.MonkeyPatch, | ||
) -> None: | ||
monkeypatch.setenv("GOOGLE_SERVICE_ACCOUNT_PATH", "__non_existent") | ||
|
||
with pytest.raises(ComputeError, match="__non_existent"): | ||
pl.scan_parquet("gs://.../...", credential_provider=None).collect() | ||
|
||
err_magic = "err_magic_3" | ||
|
||
def raises() -> pl.CredentialProviderFunctionReturn: | ||
raise AssertionError(err_magic) | ||
|
||
# We should get a different error raised by our `raises()` function. | ||
with pytest.raises(ComputeError, match=err_magic): | ||
pl.scan_parquet("gs://.../...", credential_provider=raises).collect() |