Skip to content

Conversation

@stollero
Copy link

Hello everyone,

this brings back the enhancement added with #713 that broke with f59508b.

Had minor problems getting the tests to run because https://hatch.pypa.io/latest/community/contributing/ is outdated, but https://github.com/pypa/hatch/blob/master/docs/community/contributing.md worked 👍.

Copy link
Contributor

@funkyfuture funkyfuture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry that i missed this aspect back then. from looking at Github's web ui this lgtm. @ofek, would it be of help for you if i had a closer look with an IDE on this?

@ofek
Copy link
Contributor

ofek commented Nov 7, 2024

Yes please

Comment on lines 49 to 59
class MockKeyring:
@staticmethod
def get_credential(*_):
class Credential:
username = 'gat'

return Credential()

@staticmethod
def get_password(*_):
return 'guido'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have no strong opinion on this, but it would imo make sense to

a) realize this as a test fixture that is automatically used on all tests in this module.
b) add the password attribute to the Credential dummy.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. Good idea :)

self.__username_was_read = True
return self._app.prompt(f"Username for '{self._repo_config['url']}' [__token__]") or '__token__'

def _read_keyring(self) -> str | None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could also store the __password property as i'm assuming that using a username from this credentials source doesn't make sense with a password from another source.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, no need to run read the password again if we already have it. I pushed my changes. Thanks for the review

Copy link
Contributor

@funkyfuture funkyfuture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, beside the minor import detail this looks good to merge.

(don't know whether the UI changed or it's circumstances. i can't mark the inline comment threads as resolved. they are.)

@@ -1,5 +1,7 @@
from __future__ import annotations

import keyring
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm pretty sure @ofek prefers that to be imported only when it's needed in _read_keyring.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code updated :)

@stollero stollero requested a review from funkyfuture January 21, 2025 08:11
@funkyfuture
Copy link
Contributor

@ofek not sure whether i wasn't loud enough. this is a fine fix for a regression i introduced and i would be thankful if it could get merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants