test failures in libsecret (and others)

Open
#581 29 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start with tests/test_packaging.py and tests/backends/test_libsecret.py, then reproduce the reported PEP517 wheel installation and pytest invocation. Read the related entry-point and libsecret backend code to determine the expected behavior in this environment. Done means the reported packaging and libsecret test failures are resolved and the affected tests pass.

Written by the indexing model from the issue text.

Description

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-keyring-23.6.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-keyring-23.6.0-2.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.6.0, configfile: pytest.ini
plugins: cov-3.0.0, flake8-1.1.1
collected 93 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 .                                                                                                                                   [  9%]
tests/test_errors.py .                                                                                                                                 [ 10%]
tests/test_integration.py ...                                                                                                                          [ 13%]
tests/test_multiprocess.py xx                                                                                                                          [ 16%]
tests/test_packaging.py F.                                                                                                                             [ 18%]
tests/backends/test_SecretService.py sssssssssss.                                                                                                      [ 31%]
tests/backends/test_Windows.py ssssssssssssss                                                                                                          [ 46%]
tests/backends/test_chainer.py ..                                                                                                                      [ 48%]
tests/backends/test_kwallet.py ssssssssssssssssssssss                                                                                                  [ 72%]
tests/backends/test_libsecret.py FFFFF.FFFF..                                                                                                          [ 84%]
tests/backends/test_macOS.py ssssssssssss                                                                                                              [ 97%]
tests/util/test_platform.py .s                                                                                                                         [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:11: ValueError
_________________________________________________________ TestLibSecretKeyring.test_password_set_get _________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdedc58b0>, service = 'PxxQoDCh6oM4Q3H2K3CD', username = '5n1qwNLJfMjtnjYIybQ6'

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
>           items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:62: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf762880>

    def test_password_set_get(self):
        password = random_string(20)
        username = random_string(20)
        service = random_string(20)
>       self.check_set_get(service, username, password)

keyring/testing/backend.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/testing/backend.py:58: in check_set_get
    assert keyring.get_password(service, username) is None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdedc58b0>, service = 'PxxQoDCh6oM4Q3H2K3CD', username = '5n1qwNLJfMjtnjYIybQ6'

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
            items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked('Failed to unlock the item!') from error
E               keyring.errors.KeyringLocked: Failed to unlock the item!

keyring/backends/libsecret.py:68: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
_________________________________________________________ TestLibSecretKeyring.test_difficult_chars __________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fe105fa30>, service = '|``^}!|\x0b(*=[\\@\x0b<@\t$+', username = '{:+:)=>\\)`%\r [-~:\n_~'

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
>           items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:62: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf7623d0>

    def test_difficult_chars(self):
        password = random_string(20, self.DIFFICULT_CHARS)
        username = random_string(20, self.DIFFICULT_CHARS)
        service = random_string(20, self.DIFFICULT_CHARS)
>       self.check_set_get(service, username, password)

keyring/testing/backend.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/testing/backend.py:58: in check_set_get
    assert keyring.get_password(service, username) is None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fe105fa30>, service = '|``^}!|\x0b(*=[\\@\x0b<@\t$+', username = '{:+:)=>\\)`%\r [-~:\n_~'

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
            items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked('Failed to unlock the item!') from error
E               keyring.errors.KeyringLocked: Failed to unlock the item!

keyring/backends/libsecret.py:68: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
__________________________________________________________ TestLibSecretKeyring.test_delete_present __________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdf5e1250>, service = '"*[\n=]~.%/>#[!}*~)"/', username = "|:\x0c\\~=<#_+ };)'.\x0c*$\r"
password = '] #|.+?/,{*){!#\\\n<"*'

    def set_password(self, service, username, password):
        """Set password for the username of the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        label = "Password for '{}' on '{}'".format(username, service)
        try:
>           stored = Secret.password_store_sync(
                self.schema, attributes, self.collection, label, password, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:88: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf73cbb0>

    def test_delete_present(self):
        password = random_string(20, self.DIFFICULT_CHARS)
        username = random_string(20, self.DIFFICULT_CHARS)
        service = random_string(20, self.DIFFICULT_CHARS)
>       self.keyring.set_password(service, username, password)

keyring/testing/backend.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdf5e1250>, service = '"*[\n=]~.%/>#[!}*~)"/', username = "|:\x0c\\~=<#_+ };)'.\x0c*$\r"
password = '] #|.+?/,{*){!#\\\n<"*'

    def set_password(self, service, username, password):
        """Set password for the username of the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        label = "Password for '{}' on '{}'".format(username, service)
        try:
            stored = Secret.password_store_sync(
                self.schema, attributes, self.collection, label, password, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('secret-error')
            if error.matches(quark, Secret.Error.IS_LOCKED):
                raise KeyringLocked("Failed to unlock the collection!") from error
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked("Failed to unlock the collection!") from error
E               keyring.errors.KeyringLocked: Failed to unlock the collection!

keyring/backends/libsecret.py:97: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
________________________________________________________ TestLibSecretKeyring.test_delete_not_present ________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdf644670>, service = '\x0b\n^\x0c\n@\x0b$@\n<^++~::/ #', username = "'[\\#}\n:|))&>%[=\n,'_*"

    def delete_password(self, service, username):
        """Delete the stored password (only the first one)"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
>           items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:110: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf73c040>

    def test_delete_not_present(self):
        username = random_string(20, self.DIFFICULT_CHARS)
        service = random_string(20, self.DIFFICULT_CHARS)
        with pytest.raises(errors.PasswordDeleteError):
>           self.keyring.delete_password(service, username)

keyring/testing/backend.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdf644670>, service = '\x0b\n^\x0c\n@\x0b$@\n<^++~::/ #', username = "'[\\#}\n:|))&>%[=\n,'_*"

    def delete_password(self, service, username):
        """Delete the stored password (only the first one)"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
            items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked('Failed to unlock the item!') from error
E               keyring.errors.KeyringLocked: Failed to unlock the item!

keyring/backends/libsecret.py:116: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
_______________________________________________________ TestLibSecretKeyring.test_delete_one_in_group ________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdedbfb80>, service = '%/\x0b?%`"(;)"(!\\<&-~:-', username = '\n-`:\t^^\x0b?%+)\x0c\t=\t}}["'
password = ']*;:"$_-\'/>(/`\n{%)|>'

    def set_password(self, service, username, password):
        """Set password for the username of the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        label = "Password for '{}' on '{}'".format(username, service)
        try:
>           stored = Secret.password_store_sync(
                self.schema, attributes, self.collection, label, password, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:88: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf73c670>

    def test_delete_one_in_group(self):
        username1 = random_string(20, self.DIFFICULT_CHARS)
        username2 = random_string(20, self.DIFFICULT_CHARS)
        password = random_string(20, self.DIFFICULT_CHARS)
        service = random_string(20, self.DIFFICULT_CHARS)
>       self.keyring.set_password(service, username1, password)

keyring/testing/backend.py:99:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fdedbfb80>, service = '%/\x0b?%`"(;)"(!\\<&-~:-', username = '\n-`:\t^^\x0b?%+)\x0c\t=\t}}["'
password = ']*;:"$_-\'/>(/`\n{%)|>'

    def set_password(self, service, username, password):
        """Set password for the username of the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        label = "Password for '{}' on '{}'".format(username, service)
        try:
            stored = Secret.password_store_sync(
                self.schema, attributes, self.collection, label, password, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('secret-error')
            if error.matches(quark, Secret.Error.IS_LOCKED):
                raise KeyringLocked("Failed to unlock the collection!") from error
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked("Failed to unlock the collection!") from error
E               keyring.errors.KeyringLocked: Failed to unlock the collection!

keyring/backends/libsecret.py:97: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
__________________________________________________________ TestLibSecretKeyring.test_unicode_chars ___________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded5eb50>, service = 'τциבφνעεлекемαдетνωφ', username = 'лаъρиυаьнхаСויютαזзъ'

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
>           items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:62: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf73cf70>

    def test_unicode_chars(self):
        password = random_string(20, UNICODE_CHARS)
        username = random_string(20, UNICODE_CHARS)
        service = random_string(20, UNICODE_CHARS)
>       self.check_set_get(service, username, password)

keyring/testing/backend.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/testing/backend.py:58: in check_set_get
    assert keyring.get_password(service, username) is None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded5eb50>, service = 'τциבφνעεлекемαдетνωφ', username = 'лаъρиυаьнхаСויютαזзъ'

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
            items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked('Failed to unlock the item!') from error
E               keyring.errors.KeyringLocked: Failed to unlock the item!

keyring/backends/libsecret.py:68: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
_____________________________________________________ TestLibSecretKeyring.test_unicode_and_ascii_chars ______________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded61d90>, service = 'ш.ш1v\x0b;vR6lз%ттшG7[l', username = ",ьа1т.ш|згת1ь.'аgD[G"

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
>           items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:62: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf73c1f0>

    def test_unicode_and_ascii_chars(self):
        source = (
            random_string(10, UNICODE_CHARS)
            + random_string(10)
            + random_string(10, self.DIFFICULT_CHARS)
        )
        password = random_string(20, source)
        username = random_string(20, source)
        service = random_string(20, source)
>       self.check_set_get(service, username, password)

keyring/testing/backend.py:122:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/testing/backend.py:58: in check_set_get
    assert keyring.get_password(service, username) is None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded61d90>, service = 'ш.ш1v\x0b;vR6lз%ттшG7[l', username = ",ьа1т.ш|згת1ь.'аgD[G"

    def get_password(self, service, username):
        """Get password of the username for the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        try:
            items = Secret.password_search_sync(
                self.schema, attributes, Secret.SearchFlags.UNLOCK, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked('Failed to unlock the item!') from error
E               keyring.errors.KeyringLocked: Failed to unlock the item!

keyring/backends/libsecret.py:68: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
__________________________________________________________ TestLibSecretKeyring.test_different_user __________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded795b0>, service = 'service1', username = 'user1', password = 'password1'

    def set_password(self, service, username, password):
        """Set password for the username of the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        label = "Password for '{}' on '{}'".format(username, service)
        try:
>           stored = Secret.password_store_sync(
                self.schema, attributes, self.collection, label, password, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:88: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf73c6a0>

    def test_different_user(self):
        """
        Issue #47 reports that WinVault isn't storing passwords for
        multiple users. This test exercises that test for each of the
        backends.
        """

        keyring = self.keyring
>       self.set_password('service1', 'user1', 'password1')

keyring/testing/backend.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/testing/backend.py:51: in set_password
    self.keyring.set_password(service, username, password)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded795b0>, service = 'service1', username = 'user1', password = 'password1'

    def set_password(self, service, username, password):
        """Set password for the username of the service"""
        attributes = {
            "application": self.appid,
            "service": service,
            "username": username,
        }
        label = "Password for '{}' on '{}'".format(username, service)
        try:
            stored = Secret.password_store_sync(
                self.schema, attributes, self.collection, label, password, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('secret-error')
            if error.matches(quark, Secret.Error.IS_LOCKED):
                raise KeyringLocked("Failed to unlock the collection!") from error
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked("Failed to unlock the collection!") from error
E               keyring.errors.KeyringLocked: Failed to unlock the collection!

keyring/backends/libsecret.py:97: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
____________________________________________________________ TestLibSecretKeyring.test_credential ____________________________________________________________

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded5e220>, service = 'service', username = None

    def get_credential(self, service, username):
        """Get the first username and password for a service.
        Return a Credential instance

        The username can be omitted, but if there is one, it will use get_password
        and return a SimpleCredential containing  the username and password
        Otherwise, it will return the first username and password combo that it finds.
        """
        query = {"service": service}
        if username:
            query["username"] = username
        try:
>           items = Secret.password_search_sync(
                self.schema, query, Secret.SearchFlags.UNLOCK, None
            )
E           gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)

keyring/backends/libsecret.py:143: Error

The above exception was the direct cause of the following exception:

self = <test_libsecret.TestLibSecretKeyring object at 0x7f2fdf73c070>

    def test_credential(self):
        keyring = self.keyring

>       cred = keyring.get_credential('service', None)

keyring/testing/backend.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <keyring.backends.libsecret.Keyring object at 0x7f2fded5e220>, service = 'service', username = None

    def get_credential(self, service, username):
        """Get the first username and password for a service.
        Return a Credential instance

        The username can be omitted, but if there is one, it will use get_password
        and return a SimpleCredential containing  the username and password
        Otherwise, it will return the first username and password combo that it finds.
        """
        query = {"service": service}
        if username:
            query["username"] = username
        try:
            items = Secret.password_search_sync(
                self.schema, query, Secret.SearchFlags.UNLOCK, None
            )
        except GLib.Error as error:
            quark = GLib.quark_try_string('g-io-error-quark')
            if error.matches(quark, Gio.IOErrorEnum.FAILED):
>               raise KeyringLocked('Failed to unlock the item!') from error
E               keyring.errors.KeyringLocked: Failed to unlock the item!

keyring/backends/libsecret.py:149: KeyringLocked
------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------
Testing LibSecretKeyring; the following password prompts are for this keyring
================================================================== short test summary info ===================================================================
SKIPPED [1] keyring/testing/backend.py:68: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:74: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:80: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:88: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:94: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:104: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:107: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:113: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:124: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:139: SecretStorage package is needed for SecretServiceKeyring
SKIPPED [1] keyring/testing/backend.py:161: SecretStorage package is needed for SecretServiceKeyring
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
SKIPPED [1] tests/backends/test_macOS.py:16: macOS backend not viable
SKIPPED [1] tests/util/test_platform.py:12: condition: platform.system() != "Windows"
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)
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_password_set_get - keyring.errors.KeyringLocked: Failed to unlock the item!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_difficult_chars - keyring.errors.KeyringLocked: Failed to unlock the item!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_delete_present - keyring.errors.KeyringLocked: Failed to unlock the collection!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_delete_not_present - keyring.errors.KeyringLocked: Failed to unlock the item!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_delete_one_in_group - keyring.errors.KeyringLocked: Failed to unlock the collection!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_unicode_chars - keyring.errors.KeyringLocked: Failed to unlock the item!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_unicode_and_ascii_chars - keyring.errors.KeyringLocked: Failed to unlock the item!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_different_user - keyring.errors.KeyringLocked: Failed to unlock the collection!
FAILED tests/backends/test_libsecret.py::TestLibSecretKeyring::test_credential - keyring.errors.KeyringLocked: Failed to unlock the item!
==================================================== 10 failed, 21 passed, 60 skipped, 2 xfailed in 1.07s ====================================================
Dominant language
Python
Stars
1.5k
Forks
208
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jaraco/keyring

All issues in jaraco/keyring

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.