def mock_chainer_backend(mocker): from keyring.backends.fail import Keyring mocker.patch("keyring.backend.get_all_keyring", [Keyring()]) import keyring from keyring.backends.chainer import ChainerBackend keyring.set_keyring(ChainerBackend())
def with_chained_keyring(mocker: "MockerFixture") -> None: from keyring.backends.fail import Keyring mocker.patch("keyring.backend.get_all_keyring", [Keyring()]) import keyring from keyring.backends.chainer import ChainerBackend keyring.set_keyring(ChainerBackend())
def with_chained_null_keyring(mocker: MockerFixture) -> None: from keyring.backends.null import Keyring mocker.patch("keyring.backend.get_all_keyring", lambda: [Keyring()]) import keyring from keyring.backends.chainer import ChainerBackend keyring.set_keyring(ChainerBackend())
def config(config_source, auth_config_source, mocker): import keyring from keyring.backends.fail import Keyring keyring.set_keyring(Keyring()) c = Config() c.merge(config_source.config) c.set_config_source(config_source) c.set_auth_config_source(auth_config_source) mocker.patch("poetry.factory.Factory.create_config", return_value=c) mocker.patch("poetry.config.config.Config.set_config_source") return c
def config( config_source: DictConfigSource, auth_config_source: DictConfigSource, mocker: MockerFixture, ) -> Config: import keyring from keyring.backends.fail import Keyring keyring.set_keyring(Keyring()) c = Config() c.merge(config_source.config) c.set_config_source(config_source) c.set_auth_config_source(auth_config_source) mocker.patch("poetry.config.config.Config.create", return_value=c) mocker.patch("poetry.config.config.Config.set_config_source") return c
def with_fail_keyring() -> None: import keyring from keyring.backends.fail import Keyring keyring.set_keyring(Keyring())
def with_null_keyring() -> None: import keyring from keyring.backends.null import Keyring keyring.set_keyring(Keyring())
def mock_unavailable_backend(): import keyring from keyring.backends.fail import Keyring keyring.set_keyring(Keyring())