Bug 263585 - security/py-keyrings.alt: tests failing, update needed
Summary: security/py-keyrings.alt: tests failing, update needed
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Marakasov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-26 14:59 UTC by Dmitry Marakasov
Modified: 2022-11-01 13:29 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (douglas)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov freebsd_committer freebsd_triage 2022-04-26 14:59:45 UTC
security/py-keyrings.alt needs to be updated to the latest 4.1.0. Most tests currently fail because ancient pycrypto is used which is not compatible with our current python 3.8.

__________________ CryptedFileKeyringTestCase.test_credential __________________

self = <tests.test_crypto.CryptedFileKeyringTestCase testMethod=test_credential>

    def test_credential(self):
        keyring = self.keyring
    
        cred = keyring.get_credential('service', None)
        assert cred is None
    
>       self.set_password('service1', 'user1', 'password1')

/usr/local/lib/python3.8/site-packages/keyring/tests/test_backend.py:144: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.8/site-packages/keyring/tests/test_backend.py:53: in set_password
    self.keyring.set_password(service, username, password)
keyrings/alt/file_base.py:135: in set_password
    password_encrypted = self.encrypt(password.encode('utf-8'), assoc)
keyrings/alt/file.py:203: in encrypt
    salt = get_random_bytes(self.block_size)
/usr/local/lib/python3.8/site-packages/Crypto/Random/__init__.py:41: in get_random_bytes
    return _UserFriendlyRNG.get_random_bytes(n)
/usr/local/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py:228: in get_random_bytes
    return _get_singleton().read(n)
/usr/local/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py:178: in read
    return _UserFriendlyRNG.read(self, bytes)
/usr/local/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py:129: in read
    self._ec.collect()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Crypto.Random._UserFriendlyRNG._EntropyCollector object at 0x80344ffd0>

    def collect(self):
        # Collect 64 bits of entropy from the operating system and feed it to Fortuna.
        self._osrng_es.feed(self._osrng.read(8))
    
        # Add the fractional part of time.time()
        t = time.time()
        self._time_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
    
        # Add the fractional part of time.clock()
>       t = time.clock()
E       AttributeError: module 'time' has no attribute 'clock'

/usr/local/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py:77: AttributeError
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-04-27 11:43:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0a452342de5da5db62f493d6d556fa308419e2dc

commit 0a452342de5da5db62f493d6d556fa308419e2dc
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2022-04-26 15:16:43 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2022-04-27 11:42:13 +0000

    security/py-keyrings.alt: convert to USES=pytest

    The tests still fail because of pycrypto which is not compatible
    with our python 3.8. This may be fixed by either updating [1] this
    port to a newer version which drops the pycrypto dependency, or
    fixing pycrypto [2].

    PR:             263585 [1], 263586 [2]
    Reported by:    reprise
    Approved by:    portmgr blanket

 security/py-keyrings.alt/Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)