Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jaraco/keyring
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v24.1.0
Choose a base ref
...
head repository: jaraco/keyring
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v24.1.1
Choose a head ref
  • 4 commits
  • 4 files changed
  • 2 contributors

Commits on Jun 23, 2023

  1. Revert "Mark multiprocess tests as xfail for now. Ref #634."

    This reverts commit 7c15811.
    
    Fixes #634.
    jaraco committed Jun 23, 2023
    Copy the full SHA
    ffe8b5f View commit details
  2. Copy the full SHA
    00e6fd9 View commit details

Commits on Jun 24, 2023

  1. Add changelog

    jaraco committed Jun 24, 2023
    Copy the full SHA
    c0c8e9e View commit details
  2. Finalize

    jaraco committed Jun 24, 2023
    Copy the full SHA
    443d327 View commit details
Showing with 36 additions and 6 deletions.
  1. +9 −0 NEWS.rst
  2. +1 −0 keyring/core.py
  3. +26 −2 tests/test_core.py
  4. +0 −4 tests/test_multiprocess.py
9 changes: 9 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v24.1.1
=======

Bugfixes
--------

- Restore support for reading from a config file (with regression test). (#638)


v24.1.0
=======

1 change: 1 addition & 0 deletions keyring/core.py
Original file line number Diff line number Diff line change
@@ -153,6 +153,7 @@ def _config_path():
def _ensure_path(path):
if not path.exists():
raise FileNotFoundError(path)
return path


def load_config() -> typing.Optional[backend.KeyringBackend]:
28 changes: 26 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import keyring.core
from unittest.mock import patch
import pathlib
import tempfile


def test_init_recommended(monkeypatch):
@@ -10,5 +13,26 @@ def test_init_recommended(monkeypatch):


def test_load_config_missing(caplog):
assert keyring.core.load_config() is None
assert not caplog.records
with tempfile.TemporaryDirectory() as tmpdirname:
path = pathlib.Path(tmpdirname) / "keyringrc.cfg"
with patch.object(
keyring.core, '_config_path', return_value=path
) as config_path_mock:
assert keyring.core.load_config() is None
assert not caplog.records

config_path_mock.assert_called_once()


def test_load_config_exists(caplog):
with tempfile.TemporaryDirectory() as tmpdirname:
path = pathlib.Path(tmpdirname) / "keyringrc.cfg"
with open(path, "w", encoding='UTF-8') as file:
file.write('[backend]\ndefault-keyring=keyring.backends.fail.Keyring\n')
with patch.object(
keyring.core, '_config_path', return_value=path
) as config_path_mock:
assert keyring.core.load_config() is not None
assert not caplog.records

config_path_mock.assert_called_once()
4 changes: 0 additions & 4 deletions tests/test_multiprocess.py
Original file line number Diff line number Diff line change
@@ -21,10 +21,6 @@ def subprocess_get():
sys.version_info < (3, 8) and platform.system() == 'Darwin',
reason="#281, #494: Prior to 3.8, multiprocess invocation fails",
),
pytest.mark.xfail(
platform.system() == 'Windows' and sys.version_info > (3, 12),
reason="#634; apparent regression in CPython",
),
]