sumerc / yappi

Yet Another Python Profiler, but this time multithreading, asyncio and gevent aware.
MIT License
1.44k stars 72 forks source link

Tests are broken on Python 3.11 due to @asyncio.coroutine use #103

Closed mgorny closed 8 months ago

mgorny commented 2 years ago

The @asyncio.coroutine decorator has been deprecated since Python 3.8, and is removed entirely in 3.11. This causes the tests to fail immediately:

$ python3.11 run_tests.py 
Traceback (most recent call last):
  File "/tmp/yappi/run_tests.py", line 29, in <module>
    test_suite = test_loader.loadTestsFromNames(tests)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yappi/tests/test_asyncio.py", line 8, in <module>
    @asyncio.coroutine
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'. Did you mean: 'coroutines'?

IIUC the replacement is async def, with await instead of yield from.

hugovk commented 9 months ago

This can be closed now https://github.com/sumerc/yappi/pull/107 has been merged.