jaraco / jaraco/keyring

Testing fails when there is no `keyrings.alt` installed

Open
#737 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.5k
Forks
196
PR merge metrics
No merged PRs in 30d

Description

```
$ tox -e py314 -- -v

...

=================================================================================== FAILURES ====================================================================================
_____________________________________________________________________________ test_multiprocess_get _____________________________________________________________________________

def test_multiprocess_get():
proc1 = multiprocessing.Process(target=subprocess_get)
proc1.start()
proc1.join()
> assert proc1.exitcode == 0
E AssertionError: assert 1 == 0
E + where 1 = .exitcode

tests/test_multiprocess.py:35: AssertionError
----------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.14/multiprocessing/process.py", line 320, in _bootstrap
self.run()
~~~~~~~~^^
File "/usr/lib/python3.14/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/builds/ul-workspace/components/python/keyring/keyring-25.7.0/tests/test_multiprocess.py", line 20, in subprocess_get
keyring.get_password('test_app', 'test_user')
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/builds/ul-workspace/components/python/keyring/keyring-25.7.0/keyring/core.py", line 65, in get_password
return get_keyring().get_password(service_name, username)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/builds/ul-workspace/components/python/keyring/keyring-25.7.0/keyring/backends/fail.py", line 28, in get_password
raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
____________________________________________________________________ test_multiprocess_get_after_native_get _____________________________________________________________________

def test_multiprocess_get_after_native_get():
keyring.get_password('test_app', 'test_user')
> test_multiprocess_get()

tests/test_multiprocess.py:40:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

def test_multiprocess_get():
proc1 = multiprocessing.Process(target=subprocess_get)
proc1.start()
proc1.join()
> assert proc1.exitcode == 0
E AssertionError: assert 1 == 0
E + where 1 = .exitcode

tests/test_multiprocess.py:35: AssertionError
----------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------
Process Process-2:
Traceback (most recent call last):
File "/usr/lib/python3.14/multiprocessing/process.py", line 320, in _bootstrap
self.run()
~~~~~~~~^^
File "/usr/lib/python3.14/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/builds/ul-workspace/components/python/keyring/keyring-25.7.0/tests/test_multiprocess.py", line 20, in subprocess_get
keyring.get_password('test_app', 'test_user')
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/builds/ul-workspace/components/python/keyring/keyring-25.7.0/keyring/core.py", line 65, in get_password
return get_keyring().get_password(service_name, username)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/builds/ul-workspace/components/python/keyring/keyring-25.7.0/keyring/backends/fail.py", line 28, in get_password
raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
```
I noticed that it is enough to install `keyrings.alt` on the host machine. The installation to tox's virtualenv is not needed.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with tests/test_multiprocess.py and reproduce the failure using `tox -e py314 -- -v`. Trace how `keyring.get_password` selects a backend in keyring/core.py and keyring/backends/fail.py, then make the multiprocess tests pass without requiring keyrings.alt on the host; rerun the same tox command to verify.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.