achimnol / aiotools

Idiomatic asyncio utilties
https://aiotools.readthedocs.io
MIT License
153 stars 11 forks source link

Two test_actxgroup failures on ARM aarch64 #43

Closed jayvdb closed 2 years ago

jayvdb commented 2 years ago

I've udpated https://build.opensuse.org/package/show/home:jayvdb:py-submit/python-aiotools to v1.5.3. I'm still waiting for the armv7l to start in order to check the status of https://github.com/achimnol/aiotools/issues/24 , but have results back for aarch64, where it fails on Python 3.9, but not Python 3.6.

=================================== FAILURES ===================================
________________________________ test_actxgroup ________________________________

event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>

    @pytest.mark.asyncio
    async def test_actxgroup(event_loop):

        # Test basic function.
        exit_count = 0

        @aiotools.actxmgr
        async def ctx(a):
            nonlocal exit_count
            await asyncio.sleep(0)
            yield a + 10
            await asyncio.sleep(0)
            exit_count += 1

        ctxgrp = aiotools.actxgroup()

        for i in range(3):
            ctxgrp.add(ctx(i))

        async with ctxgrp as values:
            assert values[0] == 10
            assert values[1] == 11
            assert values[2] == 12
            assert len(ctxgrp._cm_yields) == 3

        assert exit_count == 3
        assert len(ctxgrp._cm_yields) == 0
        returns = ctxgrp.exit_states()
>       assert returns[0] is None
E       assert False is None

tests/test_context.py:591: AssertionError
______________________ test_actxgroup_exception_from_body ______________________

event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>

    @pytest.mark.asyncio
    async def test_actxgroup_exception_from_body(event_loop):

        exit_count = 0

        @aiotools.actxmgr
        async def ctx(a):
            nonlocal exit_count
            await asyncio.sleep(0)
            yield a
            await asyncio.sleep(0)
            # yield raises the exception from the context body.
            # If not handled, finalization will not be executed.
            exit_count += 1

        ctxgrp = aiotools.actxgroup([ctx(1), ctx(2)])

        try:
            async with ctxgrp as values:
                assert values[0] == 1
                assert values[1] == 2
                raise ZeroDivisionError
        except Exception as e:
            assert isinstance(e, ZeroDivisionError)

        exits = ctxgrp.exit_states()
>       assert exits[0] is None  # __aexit__ are called successfully
E       assert False is None

tests/test_context.py:683: AssertionError
jayvdb commented 2 years ago

I was able to fix this by updating dependencies.