aio-libs / aiozmq

Asyncio (pep 3156) integration with ZeroMQ
aiozmq.readthedocs.org
BSD 2-Clause "Simplified" License
422 stars 56 forks source link

Can't run tests on python 3.11 #185

Open beenje opened 2 years ago

beenje commented 2 years ago
______________________ ERROR collecting tests/rpc_test.py ______________________
tests/rpc_test.py:22: in <module>
    class MyHandler(aiozmq.rpc.AttrHandler):
tests/rpc_test.py:55: in MyHandler
    @asyncio.coroutine
E   AttributeError: module 'asyncio' has no attribute 'coroutine'

asyncio.coroutine was removed in Python 3.11 but is still used in tests/rpc_test.py

JelleZijlstra commented 2 years ago

Weirdly these tests pass in CI, I wonder how that is working.

beenje commented 2 years ago

Looking at the CI logs:

running check
[28](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:29)
Skipping 'rpc_test': module 'asyncio' has no attribute 'coroutine'
[29](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:30)
Traceback (most recent call last):
[30](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:31)
  File "/home/runner/work/aiozmq/aiozmq/runtests.py", line 145, in load_modules
[31](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:32)
    mods.append((loader.load_module(), sourcefile))
[32](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:33)
                 ^^^^^^^^^^^^^^^^^^^^
[33](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:34)
  File "<frozen importlib._bootstrap_external>", line 605, in _check_name_wrapper
[34](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:35)
  File "<frozen importlib._bootstrap_external>", line 1120, in load_module
[35](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:36)
  File "<frozen importlib._bootstrap_external>", line 945, in load_module
[36](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:37)
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
[37](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:38)
  File "<frozen importlib._bootstrap>", line 721, in _load
[38](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:39)
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
[39](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:40)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
[40](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:41)
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
[41](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:42)
  File "tests/rpc_test.py", line 22, in <module>
[42](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:43)
    class MyHandler(aiozmq.rpc.AttrHandler):
[43](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:44)
  File "tests/rpc_test.py", line 55, in MyHandler
[44](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:45)
    @asyncio.coroutine
[45](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:46)
     ^^^^^^^^^^^^^^^^^
[46](https://github.com/aio-libs/aiozmq/actions/runs/3382392260/jobs/5617269355#step:6:47)
AttributeError: module 'asyncio' has no attribute 'coroutine'

Not sure why this isn't reported as an error. I see that python setup.py check is used. Invoking setup.py directly is deprecated: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html

I'd recommend to just run pytest.