ikalnytskyi / picobox

Dependency injection framework designed with Python in mind.
https://picobox.readthedocs.io
MIT License
49 stars 4 forks source link

current release has test failures when building with Python 3.10 #55

Closed flokli closed 1 year ago

flokli commented 2 years ago
============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0
rootdir: /build/source
collected 1266 items                                                           

tests/test_box.py ...................................................... [  4%]
........................................................................ [  9%]
........................................................................ [ 15%]
........FF............                                                   [ 17%]
tests/test_scopes.py s.................................................. [ 21%]
........................................................................ [ 27%]
........................................................................ [ 32%]
........................................................................ [ 38%]
........................................................................ [ 44%]
................................                                         [ 46%]
tests/test_stack.py .................................................... [ 50%]
........................................................................ [ 56%]
........................................................................ [ 62%]
........................................................................ [ 67%]
........................................................................ [ 73%]
........................................................................ [ 79%]
..........................................................FFFF.......... [ 84%]
..............                                                           [ 86%]
tests/contrib/test_flaskscopes.py ...................................... [ 89%]
........................................................................ [ 94%]
...................................................................      [100%]

=================================== FAILURES ===================================
____________________ test_box_pass_unexpected_argument[Box] ____________________

boxclass = <class 'picobox._box.Box'>

    def test_box_pass_unexpected_argument(boxclass):
        testbox = boxclass()
        testbox.put('d', 10)

        @testbox.pass_('d')
        def fn(a, b):
            return a + b

        with pytest.raises(TypeError) as excinfo:
            fn(1, 2)

>       assert str(excinfo.value) == "fn() got an unexpected keyword argument 'd'"
E       assert "test_box_pas... argument 'd'" == "fn() got an ... argument 'd'"
E         - fn() got an unexpected keyword argument 'd'
E         + test_box_pass_unexpected_argument.<locals>.fn() got an unexpected keyword argument 'd'

tests/test_box.py:371: AssertionError
_________________ test_box_pass_unexpected_argument[ChainBox] __________________

boxclass = <class 'picobox._box.ChainBox'>

    def test_box_pass_unexpected_argument(boxclass):
        testbox = boxclass()
        testbox.put('d', 10)

        @testbox.pass_('d')
        def fn(a, b):
            return a + b

        with pytest.raises(TypeError) as excinfo:
            fn(1, 2)

>       assert str(excinfo.value) == "fn() got an unexpected keyword argument 'd'"
E       assert "test_box_pas... argument 'd'" == "fn() got an ... argument 'd'"
E         - fn() got an unexpected keyword argument 'd'
E         + test_box_pass_unexpected_argument.<locals>.fn() got an unexpected keyword argument 'd'

tests/test_box.py:371: AssertionError
______________ test_box_pass_unexpected_argument[Box-teststack0] _______________

boxclass = <class 'picobox._box.Box'>, teststack = <Stack (0x7ffff64c56f0)>

    def test_box_pass_unexpected_argument(boxclass, teststack):
        testbox = boxclass()
        testbox.put('d', 10)

        @teststack.pass_('d')
        def fn(a, b):
            return a + b

        with teststack.push(testbox):
            with pytest.raises(TypeError) as excinfo:
                fn(1, 2)

>       assert str(excinfo.value) == "fn() got an unexpected keyword argument 'd'"
E       assert "test_box_pas... argument 'd'" == "fn() got an ... argument 'd'"
E         - fn() got an unexpected keyword argument 'd'
E         + test_box_pass_unexpected_argument.<locals>.fn() got an unexpected keyword argument 'd'

tests/test_stack.py:437: AssertionError
________________ test_box_pass_unexpected_argument[Box-picobox] ________________

boxclass = <class 'picobox._box.Box'>
teststack = <module 'picobox' from '/nix/store/322w5r8nncx3yhms0aaslyf72pv0632d-python3.10-picobox-2.2.0/lib/python3.10/site-packages/picobox/__init__.py'>

    def test_box_pass_unexpected_argument(boxclass, teststack):
        testbox = boxclass()
        testbox.put('d', 10)

        @teststack.pass_('d')
        def fn(a, b):
            return a + b

        with teststack.push(testbox):
            with pytest.raises(TypeError) as excinfo:
                fn(1, 2)

>       assert str(excinfo.value) == "fn() got an unexpected keyword argument 'd'"
E       assert "test_box_pas... argument 'd'" == "fn() got an ... argument 'd'"
E         - fn() got an unexpected keyword argument 'd'
E         + test_box_pass_unexpected_argument.<locals>.fn() got an unexpected keyword argument 'd'

tests/test_stack.py:437: AssertionError
____________ test_box_pass_unexpected_argument[ChainBox-teststack0] ____________

boxclass = <class 'picobox._box.ChainBox'>, teststack = <Stack (0x7ffff64c56f0)>

    def test_box_pass_unexpected_argument(boxclass, teststack):
        testbox = boxclass()
        testbox.put('d', 10)

        @teststack.pass_('d')
        def fn(a, b):
            return a + b

        with teststack.push(testbox):
            with pytest.raises(TypeError) as excinfo:
                fn(1, 2)

>       assert str(excinfo.value) == "fn() got an unexpected keyword argument 'd'"
E       assert "test_box_pas... argument 'd'" == "fn() got an ... argument 'd'"
E         - fn() got an unexpected keyword argument 'd'
E         + test_box_pass_unexpected_argument.<locals>.fn() got an unexpected keyword argument 'd'

tests/test_stack.py:437: AssertionError
_____________ test_box_pass_unexpected_argument[ChainBox-picobox] ______________

boxclass = <class 'picobox._box.ChainBox'>
teststack = <module 'picobox' from '/nix/store/322w5r8nncx3yhms0aaslyf72pv0632d-python3.10-picobox-2.2.0/lib/python3.10/site-packages/picobox/__init__.py'>

    def test_box_pass_unexpected_argument(boxclass, teststack):
        testbox = boxclass()
        testbox.put('d', 10)

        @teststack.pass_('d')
        def fn(a, b):
            return a + b

        with teststack.push(testbox):
            with pytest.raises(TypeError) as excinfo:
                fn(1, 2)

>       assert str(excinfo.value) == "fn() got an unexpected keyword argument 'd'"
E       assert "test_box_pas... argument 'd'" == "fn() got an ... argument 'd'"
E         - fn() got an unexpected keyword argument 'd'
E         + test_box_pass_unexpected_argument.<locals>.fn() got an unexpected keyword argument 'd'

tests/test_stack.py:437: AssertionError
=============================== warnings summary ===============================
tests/test_scopes.py: 13 warnings
  /build/source/tests/test_scopes.py:61: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    coroutine_function = asyncio.coroutine(coroutine_function)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_box.py::test_box_pass_unexpected_argument[Box] - assert "te...
FAILED tests/test_box.py::test_box_pass_unexpected_argument[ChainBox] - asser...
FAILED tests/test_stack.py::test_box_pass_unexpected_argument[Box-teststack0]
FAILED tests/test_stack.py::test_box_pass_unexpected_argument[Box-picobox] - ...
FAILED tests/test_stack.py::test_box_pass_unexpected_argument[ChainBox-teststack0]
FAILED tests/test_stack.py::test_box_pass_unexpected_argument[ChainBox-picobox]
============ 6 failed, 1259 passed, 1 skipped, 13 warnings in 2.08s ============

The same tests pass with Python 3.9 without problems.

flokli commented 2 years ago

It looks like this already got fixed in https://github.com/ikalnytskyi/picobox/pull/51, it's just that there's no release with these fixes yet?

ikalnytskyi commented 1 year ago

Just made a release. Sorry for inconvenience.

flokli commented 1 year ago

Thanks for the ping! I updated our nixpkgs version in https://github.com/NixOS/nixpkgs/pull/224665.