Skip to content

Commit 86723c4

Browse files
committed
Add verbose logging for getting keyring credentials
1 parent d82cd00 commit 86723c4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tests/test_auth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ def get_password(system, user):
8686
assert res.password == "real_user@system sekure pa55word"
8787

8888
assert caplog.messages == [
89+
"Querying keyring for username",
8990
"username set from keyring",
91+
"Querying keyring for password",
9092
"password set from keyring",
9193
]
9294

twine/auth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def system(self) -> Optional[str]:
5656
def get_username_from_keyring(self) -> Optional[str]:
5757
try:
5858
system = cast(str, self.system)
59+
logger.info("Querying keyring for username")
5960
creds = keyring.get_credential(system, None)
6061
if creds:
6162
return cast(str, creds.username)
@@ -70,6 +71,7 @@ def get_password_from_keyring(self) -> Optional[str]:
7071
try:
7172
system = cast(str, self.system)
7273
username = cast(str, self.username)
74+
logger.info("Querying keyring for password")
7375
return cast(str, keyring.get_password(system, username))
7476
except Exception as exc:
7577
warnings.warn(str(exc))

0 commit comments

Comments
 (0)