-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #598 from jaraco/bugfix/596
Apply workaround for decoratated function unrecognized
- Loading branch information
Showing
3 changed files
with
25 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
v23.9.3 | ||
------- | ||
|
||
* #596: Add workaround for devpi_client hook with wrapped implementation. | ||
|
||
v23.9.2 | ||
------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
import contextlib | ||
import functools | ||
|
||
from pluggy import HookimplMarker | ||
import pluggy | ||
|
||
import keyring | ||
from keyring.errors import KeyringError | ||
import keyring.errors | ||
|
||
|
||
hookimpl = HookimplMarker("devpiclient") | ||
hookimpl = pluggy.HookimplMarker("devpiclient") | ||
|
||
|
||
# https://github.com/jaraco/jaraco.context/blob/c3a9b739/jaraco/context.py#L205 | ||
suppress = type('suppress', (contextlib.suppress, contextlib.ContextDecorator), {}) | ||
|
||
|
||
def restore_signature(func): | ||
# workaround for pytest-dev/pluggy#358 | ||
@functools.wraps(func) | ||
def wrapper(url, username): | ||
return func(url, username) | ||
|
||
return wrapper | ||
|
||
|
||
@hookimpl() | ||
@suppress(KeyringError) | ||
@restore_signature | ||
@suppress(keyring.errors.KeyringError) | ||
def devpiclient_get_password(url, username): | ||
""" | ||
>>> pluggy._hooks.varnames(devpiclient_get_password) | ||
(('url', 'username'), ()) | ||
>>> | ||
""" | ||
return keyring.get_password(url, username) |