quantmind / pulsar

Event driven concurrent framework for Python
BSD 3-Clause "New" or "Revised" License
1.87k stars 162 forks source link

Py37 #313

Closed scailer closed 4 years ago

scailer commented 6 years ago

Updates for python 3.7

  1. Rename async -> asynclib (async become language keyword)

  2. Fix tests/http/test_tools.py Changed in version 3.7: Moved from RFC 2396 to RFC 3986 for quoting URL strings. “~” is now included in the set of reserved characters. https://docs.python.org/3.7/library/urllib.parse.html#module-urllib.parse

  3. Fix pulsar/asynclib/lock.py Changed in version 3.7: When fut is cancelled due to a timeout, wait_for now waits for fut to be cancelled. Previously, it raised TimeoutError immediately. https://docs.python.org/3/library/asyncio-task.html

scailer commented 6 years ago

Sometimes (~10%) get error in tests. Can't understand reasons.

ERROR: http.client.test_raw_stream_large (home.scailer.tmp.pulsar.tests.http.test.client.TestHttpClient)
----------------------------------------------------------------------
Traceback (most recent call last):

  File "/home/scailer/tmp/pulsar/pulsar/apps/test/runner.py", line 234, in store_trace
    await coro

  File "/home/scailer/tmp/pulsar/tests/http/base.py", line 848, in test_raw_stream_large
    data = await raw.read()

  File "/home/scailer/tmp/pulsar/pulsar/apps/http/stream.py", line 33, in read
    async for body in self:

  File "/home/scailer/tmp/pulsar/pulsar/apps/http/stream.py", line 62, in __anext__
    return await self._queue.get()

  File "/usr/lib64/python3.7/asyncio/queues.py", line 159, in get
    await getter

concurrent.futures._base.CancelledError
lsbardel commented 6 years ago

wow, thanks for this PR. Lots of changes

lsbardel commented 6 years ago

I think it is time to switch to pytest

sah commented 5 years ago

+1 for this PR. I just ran into some problems that are fixed here when trying to upgrade to python 3.7. Pulsar doesn't work on 3.7 without it.