Hello community,
here is the log from the commit of package python-async-timeout for
openSUSE:Factory checked in at 2017-10-26 18:46:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-async-timeout (Old)
and /work/SRC/openSUSE:Factory/.python-async-timeout.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-async-timeout"
Thu Oct 26 18:46:20 2017 rev:3 rq:536833 version:2.0.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-async-timeout/python-async-timeout.changes
2017-09-13 22:36:55.667919258 +0200
+++
/work/SRC/openSUSE:Factory/.python-async-timeout.new/python-async-timeout.changes
2017-10-26 18:46:22.138392847 +0200
@@ -1,0 +2,9 @@
+Sun Oct 22 07:03:32 UTC 2017 - [email protected]
+
+- Update to version 2.0.0
+ * Changed timeout <= 0 behaviour
+ + Backward incompatibility change, prior this version 0 was
+ shortcut for None
+ + when timeout <= 0 TimeoutError raised faster
+
+-------------------------------------------------------------------
Old:
----
async-timeout-1.4.0.tar.gz
New:
----
async-timeout-2.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-async-timeout.spec ++++++
--- /var/tmp/diff_new_pack.Pmqe4x/_old 2017-10-26 18:46:22.926356067 +0200
+++ /var/tmp/diff_new_pack.Pmqe4x/_new 2017-10-26 18:46:22.930355881 +0200
@@ -21,7 +21,7 @@
%define skip_python2 1
%{!?license: %global license %doc}
Name: python-async-timeout
-Version: 1.4.0
+Version: 2.0.0
Release: 0
Summary: Timeout context manager for asyncio programs
License: Apache-2.0
++++++ async-timeout-1.4.0.tar.gz -> async-timeout-2.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-1.4.0/CHANGES.rst
new/async-timeout-2.0.0/CHANGES.rst
--- old/async-timeout-1.4.0/CHANGES.rst 2017-09-09 18:52:08.000000000 +0200
+++ new/async-timeout-2.0.0/CHANGES.rst 2017-10-09 12:43:29.000000000 +0200
@@ -1,6 +1,15 @@
CHANGES
=======
+2.0.0 (2017-10-09)
+------------------
+
+* Changed `timeout <= 0` behaviour
+
+ * Backward incompatibility change, prior this version `0` was
+ shortcut for `None`
+ * when timeout <= 0 `TimeoutError` raised faster
+
1.4.0 (2017-09-09)
------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-1.4.0/PKG-INFO
new/async-timeout-2.0.0/PKG-INFO
--- old/async-timeout-1.4.0/PKG-INFO 2017-09-09 18:52:33.000000000 +0200
+++ new/async-timeout-2.0.0/PKG-INFO 2017-10-09 12:43:59.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: async-timeout
-Version: 1.4.0
+Version: 2.0.0
Summary: Timeout context manager for asyncio programs
Home-page: https://github.com/aio-libs/async_timeout/
Author: Andrew Svetlov
@@ -80,6 +80,15 @@
CHANGES
=======
+ 2.0.0 (2017-10-09)
+ ------------------
+
+ * Changed `timeout <= 0` behaviour
+
+ * Backward incompatibility change, prior this version `0` was
+ shortcut for `None`
+ * when timeout <= 0 `TimeoutError` raised faster
+
1.4.0 (2017-09-09)
------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-1.4.0/async_timeout/__init__.py
new/async-timeout-2.0.0/async_timeout/__init__.py
--- old/async-timeout-1.4.0/async_timeout/__init__.py 2017-09-09
18:52:08.000000000 +0200
+++ new/async-timeout-2.0.0/async_timeout/__init__.py 2017-10-09
12:43:29.000000000 +0200
@@ -1,7 +1,7 @@
import asyncio
-__version__ = '1.4.0'
+__version__ = '2.0.0'
class timeout:
@@ -19,8 +19,6 @@
loop - asyncio compatible event loop
"""
def __init__(self, timeout, *, loop=None):
- if timeout is not None and timeout == 0:
- timeout = None
self._timeout = timeout
if loop is None:
loop = asyncio.get_event_loop()
@@ -56,13 +54,23 @@
return None
def _do_enter(self):
- if self._timeout is not None:
- self._task = current_task(self._loop)
- if self._task is None:
- raise RuntimeError('Timeout context manager should be used '
- 'inside a task')
- self._cancel_at = self._loop.time() + self._timeout
- self._cancel_handler = self._loop.call_at(self._cancel_at,
self._cancel_task)
+ # Support Tornado 5- without timeout
+ # Details: https://github.com/python/asyncio/issues/392
+ if self._timeout is None:
+ return self
+
+ self._task = current_task(self._loop)
+ if self._task is None:
+ raise RuntimeError('Timeout context manager should be used '
+ 'inside a task')
+
+ if self._timeout <= 0:
+ self._loop.call_soon(self._cancel_task)
+ return self
+
+ self._cancel_at = self._loop.time() + self._timeout
+ self._cancel_handler = self._loop.call_at(
+ self._cancel_at, self._cancel_task)
return self
def _do_exit(self, exc_type):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-1.4.0/async_timeout.egg-info/PKG-INFO
new/async-timeout-2.0.0/async_timeout.egg-info/PKG-INFO
--- old/async-timeout-1.4.0/async_timeout.egg-info/PKG-INFO 2017-09-09
18:52:33.000000000 +0200
+++ new/async-timeout-2.0.0/async_timeout.egg-info/PKG-INFO 2017-10-09
12:43:59.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: async-timeout
-Version: 1.4.0
+Version: 2.0.0
Summary: Timeout context manager for asyncio programs
Home-page: https://github.com/aio-libs/async_timeout/
Author: Andrew Svetlov
@@ -80,6 +80,15 @@
CHANGES
=======
+ 2.0.0 (2017-10-09)
+ ------------------
+
+ * Changed `timeout <= 0` behaviour
+
+ * Backward incompatibility change, prior this version `0` was
+ shortcut for `None`
+ * when timeout <= 0 `TimeoutError` raised faster
+
1.4.0 (2017-09-09)
------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-1.4.0/tests/test_py35.py
new/async-timeout-2.0.0/tests/test_py35.py
--- old/async-timeout-1.4.0/tests/test_py35.py 2017-09-09 18:52:08.000000000
+0200
+++ new/async-timeout-2.0.0/tests/test_py35.py 2017-10-09 12:43:29.000000000
+0200
@@ -16,3 +16,26 @@
async with timeout(1, loop=loop) as cm:
await asyncio.sleep(0, loop=loop)
assert not cm.expired
+
+
+async def test_async_zero(loop):
+ with pytest.raises(asyncio.TimeoutError):
+ async with timeout(0, loop=loop) as cm:
+ await asyncio.sleep(10, loop=loop)
+ assert cm.expired
+
+
+async def test_async_zero_coro_not_started(loop):
+ coro_started = False
+
+ async def coro():
+ nonlocal coro_started
+ coro_started = True
+
+ with pytest.raises(asyncio.TimeoutError):
+ async with timeout(0, loop=loop) as cm:
+ await asyncio.sleep(0, loop=loop)
+ await coro()
+
+ assert cm.expired
+ assert coro_started is False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-1.4.0/tests/test_timeout.py
new/async-timeout-2.0.0/tests/test_timeout.py
--- old/async-timeout-1.4.0/tests/test_timeout.py 2017-09-09
18:52:08.000000000 +0200
+++ new/async-timeout-2.0.0/tests/test_timeout.py 2017-10-09
12:43:29.000000000 +0200
@@ -80,19 +80,36 @@
assert 0.09 < dt < 0.13, dt
+def test_timeout_is_none_no_task(loop):
+ with timeout(None, loop=loop) as cm:
+ assert cm._task is None
+
+
[email protected]
+def test_timeout_enable_zero(loop):
+ with pytest.raises(asyncio.TimeoutError):
+ with timeout(0, loop=loop) as cm:
+ yield from asyncio.sleep(0.1, loop=loop)
+
+ assert cm.expired
+
+
@asyncio.coroutine
-def test_timeout_disable_zero(loop):
+def test_timeout_enable_zero_coro_not_started(loop):
+ coro_started = False
+
@asyncio.coroutine
- def long_running_task():
- yield from asyncio.sleep(0.1, loop=loop)
- return 'done'
+ def coro():
+ nonlocal coro_started
+ coro_started = True
- t0 = loop.time()
- with timeout(0, loop=loop):
- resp = yield from long_running_task()
- assert resp == 'done'
- dt = loop.time() - t0
- assert 0.09 < dt < 0.13, dt
+ with pytest.raises(asyncio.TimeoutError):
+ with timeout(0, loop=loop) as cm:
+ yield from asyncio.sleep(0, loop=loop)
+ yield from coro()
+
+ assert cm.expired
+ assert coro_started is False
@asyncio.coroutine
@@ -104,7 +121,7 @@
@asyncio.coroutine
-def test_timeout_canceled_error_is_converted_to_timeout(loop):
+def test_timeout_canceled_error_is_not_converted_to_timeout(loop):
yield from asyncio.sleep(0, loop=loop)
with pytest.raises(asyncio.CancelledError):
with timeout(0.001, loop=loop):
@@ -228,6 +245,7 @@
raise RuntimeError
assert not cm.expired
+
@asyncio.coroutine
def test_timeout_remaining(loop):
with timeout(None, loop=loop) as cm: