Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure in test_packaging in kloczek's environment #552

Closed
jaraco opened this issue Nov 28, 2021 · 9 comments
Closed

Failure in test_packaging in kloczek's environment #552

jaraco opened this issue Nov 28, 2021 · 9 comments

Comments

@jaraco
Copy link
Owner

jaraco commented Nov 28, 2021

I see at least two classes of error. The first is a single failure in test_packaging:

_____________________________________________________________________________ test_entry_point _____________________________________________________________________________

    def test_entry_point():
        """
        Keyring provides exactly one 'keyring' console script
        that's a callable.
        """
        matches = metadata.entry_points(group='console_scripts', name='keyring')
>       (script,) = matches
E       ValueError: too many values to unpack (expected 1)

tests/test_packaging.py:12: ValueError

In this case, the failure is likely due to how the tests are being run... and maybe a bug in importlib_metadata. Can you confirm what version of importlib_metadata is installed? If it's 3.5 or later (as required), I'd expect importlib_metadata to de-dupe entry points. Can you run the following to determine more about those EPs?:

python -c "import importlib_metadata as md; eps = list(md.entry_points(group='console_scripts', name='keyring')); print(eps); print([ep.dist._path for ep in eps])"

I'd expect to see something like:

[EntryPoint(name='keyring', value='keyring.cli:main', group='console_scripts')]
[PosixPath('keyring.egg-info')]

Originally posted by @jaraco in #550 (comment)

@jaraco
Copy link
Owner Author

jaraco commented Nov 28, 2021

@kloczek As mentioned in #550, can you please run that Python command in your environment to help elucidate why the entry points don't work in your environment?

@kloczek
Copy link

kloczek commented Nov 29, 2021

One sec ..

@kloczek
Copy link

kloczek commented Nov 29, 2021

[tkloczko@ss-desktop SPECS]$ python3 -c "import importlib_metadata as md; eps = list(md.entry_points(group='console_scripts', name='keyring')); print(eps); print([ep.dist._path for ep in eps])"
[EntryPoint(name='keyring', value='keyring.cli:main', group='console_scripts')]
[PosixPath('/usr/lib/python3.8/site-packages/keyring-23.3.0-py3.8.egg-info')]

@jaraco
Copy link
Owner Author

jaraco commented Dec 7, 2021

Well, that's weird. In the pytest context, you're getting two EntryPoint objects, but when you executed the command directly, you only got one. I don't yet understand why that is. Perhaps you could run pytest --pdb and when the test fails, execute the command import importlib_metadata as md; eps = list(md.entry_points(group='console_scripts', name='keyring')); print(eps); print([ep.dist._path for ep in eps]) and see what it returns.

@jaraco
Copy link
Owner Author

jaraco commented Dec 7, 2021

My guess is you have two copies of keyring lying around and importlib_metadata is picking up both.

@kloczek
Copy link

kloczek commented Dec 7, 2021

I have installes all software only out of rpm packages.

@jaraco
Copy link
Owner Author

jaraco commented Dec 8, 2021

Also, importlib_metadata 3.5+ fixes an issue where duplicate entry points are discovered for the same package, so upgrading to importlib_metadata 3.5 or later will likely also address the issue.

I don't think there's anything more keyring can do here.

@jaraco jaraco closed this as completed Dec 8, 2021
@jaraco
Copy link
Owner Author

jaraco commented May 23, 2022

There was a recent fix in importlib_metadata that could have affected use cases like this one.

@kloczek
Copy link

kloczek commented May 23, 2022

[tkloczko@devel-g2v SPECS]$ pip show importlib_metadata
Name: importlib-metadata
Version: 4.11.3
Summary: Read metadata from Python packages
Home-page: https://github.com/python/importlib_metadata
Author: Jason R. Coombs
Author-email: jaraco@jaraco.com
License: UNKNOWN
Location: /usr/lib/python3.8/site-packages
Requires: zipp
Required-by: keyring, Sphinx

and with that version result is negative

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-keyring-23.5.0-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-keyring-23.5.0-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/keyring-23.5.0, configfile: pytest.ini
plugins: cov-3.0.0, flake8-1.1.1
collected 90 items

keyring/core.py .                                                                                                                                                    [  1%]
keyring/credentials.py .                                                                                                                                             [  2%]
keyring/backends/chainer.py .                                                                                                                                        [  3%]
keyring/backends/fail.py .                                                                                                                                           [  4%]
keyring/backends/null.py .                                                                                                                                           [  5%]
keyring/util/__init__.py .                                                                                                                                           [  6%]
keyring/util/properties.py ..                                                                                                                                        [  8%]
tests/test_core.py .                                                                                                                                                 [ 10%]
tests/test_errors.py .                                                                                                                                               [ 11%]
tests/test_integration.py ...                                                                                                                                        [ 14%]
tests/test_multiprocess.py xx                                                                                                                                        [ 16%]
tests/test_packaging.py F.                                                                                                                                           [ 18%]
tests/backends/test_SecretService.py ............                                                                                                                    [ 32%]
tests/backends/test_Windows.py ssssssssssssss                                                                                                                        [ 47%]
tests/backends/test_chainer.py ..                                                                                                                                    [ 50%]
tests/backends/test_kwallet.py ssssssssssssssssssssss                                                                                                                [ 74%]
tests/backends/test_libsecret.py ............                                                                                                                        [ 87%]
tests/backends/test_macOS.py sssssssssss                                                                                                                             [100%]

================================================================================= FAILURES =================================================================================
_____________________________________________________________________________ test_entry_point _____________________________________________________________________________

    def test_entry_point():
        """
        Keyring provides exactly one 'keyring' console script
        that's a callable.
        """
        matches = metadata.entry_points(group='console_scripts', name='keyring')
>       (script,) = matches
E       ValueError: too many values to unpack (expected 1)

tests/test_packaging.py:12: ValueError
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/secretstorage/util.py:46: 1 warning
tests/test_core.py: 1 warning
tests/test_multiprocess.py: 1 warning
tests/backends/test_SecretService.py: 9 warnings
  /usr/lib/python3.8/site-packages/secretstorage/util.py:46: UserWarning: Passing unwrap= to .send_and_get_reply() is deprecated and will break in a future version of Jeepney.
    return self._connection.send_and_get_reply(msg, unwrap=True)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] keyring/testing/backend.py:68: Needs Windows
SKIPPED [1] keyring/testing/backend.py:74: Needs Windows
SKIPPED [1] keyring/testing/backend.py:80: Needs Windows
SKIPPED [1] keyring/testing/backend.py:88: Needs Windows
SKIPPED [1] keyring/testing/backend.py:94: Needs Windows
SKIPPED [1] keyring/testing/backend.py:104: Needs Windows
SKIPPED [1] keyring/testing/backend.py:107: Needs Windows
SKIPPED [1] keyring/testing/backend.py:113: Needs Windows
SKIPPED [1] keyring/testing/backend.py:124: Needs Windows
SKIPPED [1] keyring/testing/backend.py:139: Needs Windows
SKIPPED [1] keyring/testing/backend.py:161: Needs Windows
SKIPPED [1] tests/backends/test_Windows.py:50: Needs Windows
SKIPPED [1] tests/backends/test_Windows.py:53: Needs Windows
SKIPPED [1] tests/backends/test_Windows.py:65: condition: sys.platform != "win32"
SKIPPED [2] keyring/testing/backend.py:68: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:74: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:80: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:88: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:94: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:104: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:107: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:113: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:124: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:139: KWallet5 unavailable
SKIPPED [2] keyring/testing/backend.py:161: KWallet5 unavailable
SKIPPED [1] keyring/testing/backend.py:68: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:74: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:80: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:88: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:94: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:104: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:107: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:113: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:124: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:139: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:161: macOS backend not viable
XFAIL tests/test_multiprocess.py::test_multiprocess_get
  #410: keyring discovery fails intermittently
XFAIL tests/test_multiprocess.py::test_multiprocess_get_after_native_get
  #410: keyring discovery fails intermittently
FAILED tests/test_packaging.py::test_entry_point - ValueError: too many values to unpack (expected 1)
===================================================== 1 failed, 40 passed, 47 skipped, 2 xfailed, 12 warnings in 3.12s =====================================================

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

No branches or pull requests

2 participants