keria icon indicating copy to clipboard operation
keria copied to clipboard

Tests failing on v0.1.x

Open lenkan opened this issue 1 year ago • 5 comments

Version

v0.1.3 and v0.1.4-dev0

Environment

Python 3.10, Ubuntu 24.04

Expected behavior

pytest tests/ should succeed

Actual behavior

pytest tests/ fails

This is the output on v0.1.3:

Run pytest tests/
ImportError while loading conftest '/home/runner/work/keria/keria/tests/conftest.py'.
tests/conftest.py:12: in <module>
    from keria.testing import testing_helper
src/keria/testing/testing_helper.py:24: in <module>
    from keria.app import agenting, indirecting
src/keria/app/agenting.py:3[9](https://github.com/WebOfTrust/keria/actions/runs/12160356077/job/33912465955#step:6:10): in <module>
    from . import aiding, notifying, indirecting, credentialing, ipexing, delegating
src/keria/app/indirecting.py:12: in <module>
    from keri.kering import Protos
E   ImportError: cannot import name 'Protos' from 'keri.kering' (/opt/hostedtoolcache/Python/3.[12](https://github.com/WebOfTrust/keria/actions/runs/12160356077/job/33912465955#step:6:13).2/x64/lib/python3.12/site-packages/keri/kering.py)
Error: Process completed with exit code 4.

This is the output on v0.1.4-dev0

============================= test session starts ==============================
platform linux -- Python 3.10.4, pytest-[8](https://github.com/WebOfTrust/keria/actions/runs/12160314292/job/33912331499#step:6:9).3.4, pluggy-1.5.0
rootdir: /home/runner/work/keria/keria
collected 57 items

tests/app/test_agenting.py ...........                                   [ 1[9](https://github.com/WebOfTrust/keria/actions/runs/12160314292/job/33912331499#step:6:10)%]
tests/app/test_aiding.py ...........                                     [ 38%]
tests/app/test_basing.py ..                                              [ 42%]
tests/app/test_credentialing.py ......                                   [ 52%]
tests/app/test_delegating.py .                                           [ 54%]
tests/app/test_grouping.py ...                                           [ 59%]
tests/app/test_httping.py ..                                             [ 63%]
tests/app/test_indirecting.py .                                          [ 64%]
tests/app/test_ipexing.py .....                                          [ 73%]
tests/app/test_notifying.py ..                                           [ 77%]
tests/app/test_specing.py .                                              [ 78%]
tests/core/test_authing.py ..                                            [ 82%]
tests/core/test_httping.py .F                                            [ 85%]
tests/core/test_longrunning.py ..                                        [ 89%]
tests/end/test_ending.py ..                                              [ 92%]
tests/peer/test_exchanging.py ..                                         [ 96%]
tests/testing/test_testing_helper.py ..                                  [[10](https://github.com/WebOfTrust/keria/actions/runs/12160314292/job/33912331499#step:6:11)0%]

=================================== FAILURES ===================================
______________ HandleCORSTest.test_process_request_options_method ______________

self = <tests.core.test_httping.HandleCORSTest testMethod=test_process_request_options_method>

    def test_process_request_options_method(self):
        req = helpers.create_req(method='OPTIONS')
        resp = falcon.Response()
    
        with self.assertRaises(HTTPStatus) as cm:
>           self.cors_handler.process_request(req, resp)

tests/core/test_httping.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/keria/core/httping.py:[18](https://github.com/WebOfTrust/keria/actions/runs/12160314292/job/33912331499#step:6:19): in process_request
    raise HTTPStatus(falcon.HTTP_200, body='\n')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: __init__() got an unexpected keyword argument 'body'

falcon/http_status.py:57: TypeError
=========================== short test summary info ============================
FAILED tests/core/test_httping.py::HandleCORSTest::test_process_request_options_method - TypeError: __init__() got an unexpected keyword argument 'body'
======================== 1 failed, 56 passed in 36.63s =========================
Error: Process completed with exit code 1.

See the github action runs here:

  • https://github.com/WebOfTrust/keria/actions/runs/12160314292/job/33912331499
  • https://github.com/WebOfTrust/keria/actions/runs/12160356077/job/33912465955

Steps to reproduce

  • git checkout 0.1.3
  • pip install -r requirements.txt
  • pip install pytest
  • pytest tests/

lenkan avatar Dec 04 '24 13:12 lenkan

Hm, probably a keri version issue. See https://github.com/WebOfTrust/keria/compare/v0.1.3...0.1.4-dev0#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7L79 I'll take a look.

2byrds avatar Dec 04 '24 13:12 2byrds

I'm assuming this is because setup.py has >= and there is no lockfile. It's == on main as I changed it a while back, but that was the second time as it slipped to >= at some point too, so we should be on the lookout for this in PRs. Or get a lockfile (which I think requires a different package manager, I'm not sure re Python)

iFergal avatar Dec 04 '24 14:12 iFergal

Just FYI if someone else hits this. My workaround for this at the moment is to generate a requirements file from the pushed docker image:

docker run -it --rm --entrypoint "pip" weboftrust/keria:0.1.4-dev0 freeze

It will output

apispec==6.6.1
attrs==23.2.0
blake3==0.4.1
cbor2==5.6.4
cffi==1.16.0
cryptography==42.0.8
dataclasses-json==0.6.7
falcon==3.1.3
hio==0.6.10
hjson==3.1.0
http_sfv==0.9.9
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
# Editable install with no version control (keri==1.1.17)
-e /keripy
-e git+ssh://[email protected]/WebOfTrust/keria.git@24664ac6fd92f73beb45defe78edaac8f5fb7dab#egg=keria
lmdb==1.5.1
marshmallow==3.21.3
mnemonic==0.21
msgpack==1.0.8
multicommand==1.0.0
multidict==6.0.5
mypy-extensions==1.0.0
ordered-set==4.1.0
packaging==24.1
prettytable==3.10.0
pycparser==2.22
pysodium==0.7.17
PyYAML==6.0.1
referencing==0.35.1
rpds-py==0.18.1
typing-inspect==0.9.0
typing_extensions==4.12.2
wcwidth==0.2.13

Then change the keripy stuff to keri==1.1.17.

Then I can do

pip install -r <requirements file>

To "lock" the dependencies.

lenkan avatar Dec 04 '24 14:12 lenkan

from our meeting, the options:

  • freeze
  • CI/CD that checks the upstream for breaking changes (nightly build)
  • similar to npm lock file concept with npm ci

KERIA could potentially use a different package manager

2byrds avatar Dec 05 '24 13:12 2byrds

We could consider multiple package managers, for instance: poetry uv

2byrds avatar Dec 05 '24 13:12 2byrds