aio-libs / aiodns

Simple DNS resolver for asyncio
https://pypi.python.org/pypi/aiodns
MIT License
532 stars 69 forks source link

Python 3.10 test failure: ERROR: test_future_cancel: TypeError: sleep() got an unexpected keyword argument 'loop' #95

Closed mgorny closed 3 years ago

mgorny commented 3 years ago

When running tests with Python 3.10.0b1:

======================================================================
ERROR: test_future_cancel (__main__.DNSTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/aiodns/tests.py", line 122, in test_future_cancel
    self.loop.run_until_complete(coro())
  File "/usr/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/tmp/aiodns/tests.py", line 119, in coro
    await asyncio.sleep(0.1, loop=self.loop)
TypeError: sleep() got an unexpected keyword argument 'loop'
mgorny commented 3 years ago

Apparently the loop parameter was deprecated since Python 3.8.

saghul commented 3 years ago

Yeah I think we can remove the explicit loop since it will be picked from the thread local storage.

Mind sending a PR?

mgorny commented 3 years ago

Sure, will do in a minute.

saghul commented 3 years ago

Awesome, thanks!