Publish: Warn when keyring has no password (#8827)

When trying to upload without a password but with the keyring, check
that the keyring has a password for the upload URL and username and warn
if it doesn't.

Fixes #8781
This commit is contained in:
konsti 2024-11-27 20:54:49 +01:00 committed by GitHub
parent 68e3228f2b
commit 0b0d0f44f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 166 additions and 10 deletions

View file

@ -10,7 +10,7 @@ class KeyringTest(backend.KeyringBackend):
def get_password(self, service, username):
print(f"Request for {username}@{service}", file=sys.stderr)
credentials = json.loads(os.environ.get("KEYRING_TEST_CREDENTIALS") or {})
credentials = json.loads(os.environ.get("KEYRING_TEST_CREDENTIALS", "{}"))
return credentials.get(service, {}).get(username)
def set_password(self, service, username, password):