From aa2a9bdf1d30322165ce8601bbc7f2950098a6a1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Dec 2022 15:18:02 -0500 Subject: [PATCH] Delete the password even if blank. Fixes #573. --- keyring/backends/macOS/api.py | 3 ++- keyring/testing/backend.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyring/backends/macOS/api.py b/keyring/backends/macOS/api.py index 7dd89c17..d11c1ad8 100644 --- a/keyring/backends/macOS/api.py +++ b/keyring/backends/macOS/api.py @@ -1,3 +1,4 @@ +import contextlib import ctypes from ctypes import ( c_void_p, @@ -147,7 +148,7 @@ def find_generic_password(kc_name, service, username, not_found_ok=False): def set_generic_password(name, service, username, password): - if find_generic_password(name, service, username, not_found_ok=True): + with contextlib.suppress(NotFound): delete_generic_password(name, service, username) q = create_query( diff --git a/keyring/testing/backend.py b/keyring/testing/backend.py index 580e7975..efe018d6 100644 --- a/keyring/testing/backend.py +++ b/keyring/testing/backend.py @@ -71,7 +71,6 @@ def test_password_set_get(self): service = random_string(20) self.check_set_get(service, username, password) - @pytest.mark.xfail(reason="#573") def test_set_after_set_blank(self): service = random_string(20) username = random_string(20)