File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -797,7 +797,7 @@ def from_url( # noqa: C901
797797 ** kwargs ,
798798 )
799799 if scheme == "http" :
800- if config or kwargs :
800+ if config or kwargs or credential_provider :
801801 msg = "HTTPStore does not accept any configuration"
802802 raise BaseError (msg )
803803
@@ -813,6 +813,9 @@ def from_url( # noqa: C901
813813 automatic_cleanup = kwargs .pop ("automatic_cleanup" )
814814 if "mkdir" in kwargs :
815815 mkdir = kwargs .pop ("mkdir" )
816+ if credential_provider :
817+ msg = "LocalStore does not accept a credential provider"
818+ raise BaseError (msg )
816819
817820 return LocalStore .from_url (
818821 url ,
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
13from pathlib import Path
4+ from typing import TYPE_CHECKING
25
36import pytest
47
58from obstore .exceptions import BaseError , UnknownConfigurationKeyError
69from obstore .store import from_url
710
11+ if TYPE_CHECKING :
12+ from obstore .store import S3Credential
13+
814
915def test_local ():
1016 cwd = Path ().absolute ()
@@ -55,3 +61,11 @@ def test_http():
5561
5662 with pytest .raises (BaseError ):
5763 from_url (url , bucket = "test" )
64+
65+
66+ def test_credential_provider_to_http_store_raises ():
67+ def s3_credential_provider () -> S3Credential :
68+ return {"access_key_id" : "" , "secret_access_key" : "" , "expires_at" : None }
69+
70+ with pytest .raises (BaseError ):
71+ from_url ("http://mydomain/path" , credential_provider = s3_credential_provider )
You can’t perform that action at this time.
0 commit comments