Hello community,
here is the log from the commit of package python-async_timeout for
openSUSE:Factory checked in at 2018-06-28 15:14:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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 Jun 28 15:14:08 2018 rev:2 rq:619407 version:3.0.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-async_timeout/python-async_timeout.changes
2018-03-28 10:30:53.706094995 +0200
+++
/work/SRC/openSUSE:Factory/.python-async_timeout.new/python-async_timeout.changes
2018-06-28 15:14:10.879509067 +0200
@@ -1,0 +2,7 @@
+Mon Jun 25 08:06:21 UTC 2018 - [email protected]
+
+- update to 3.0.0:
+ * Drop Python 3.4, the minimal supported version is Python 3.5.3
+ * Provide type annotations
+
+-------------------------------------------------------------------
Old:
----
async-timeout-2.0.1.tar.gz
New:
----
async-timeout-3.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-async_timeout.spec ++++++
--- /var/tmp/diff_new_pack.NcDrfZ/_old 2018-06-28 15:14:11.495507938 +0200
+++ /var/tmp/diff_new_pack.NcDrfZ/_new 2018-06-28 15:14:11.503507924 +0200
@@ -21,14 +21,14 @@
%define skip_python2 1
%{!?license: %global license %doc}
Name: python-async_timeout
-Version: 2.0.1
+Version: 3.0.0
Release: 0
Summary: Timeout context manager for asyncio programs
License: Apache-2.0
Group: Development/Languages/Python
Url: https://github.com/aio-libs/async_timeout/
Source:
https://files.pythonhosted.org/packages/source/a/async_timeout/async-timeout-%{version}.tar.gz
-BuildRequires: %{python_module devel}
+BuildRequires: %{python_module devel >= 3.5.3}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
++++++ async-timeout-2.0.1.tar.gz -> async-timeout-3.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/CHANGES.rst
new/async-timeout-3.0.0/CHANGES.rst
--- old/async-timeout-2.0.1/CHANGES.rst 2018-03-13 10:44:39.000000000 +0100
+++ new/async-timeout-3.0.0/CHANGES.rst 2018-05-05 12:34:36.000000000 +0200
@@ -1,6 +1,13 @@
CHANGES
=======
+3.0.0 (2018-05-05)
+------------------
+
+- Drop Python 3.4, the minimal supported version is Python 3.5.3
+
+- Provide type annotations
+
2.0.1 (2018-03-13)
------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/PKG-INFO
new/async-timeout-3.0.0/PKG-INFO
--- old/async-timeout-2.0.1/PKG-INFO 2018-03-13 10:45:12.000000000 +0100
+++ new/async-timeout-3.0.0/PKG-INFO 2018-05-05 12:35:13.000000000 +0200
@@ -1,12 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
Name: async-timeout
-Version: 2.0.1
+Version: 3.0.0
Summary: Timeout context manager for asyncio programs
Home-page: https://github.com/aio-libs/async_timeout/
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
-Description-Content-Type: UNKNOWN
Description: async-timeout
=============
.. image::
https://travis-ci.org/aio-libs/async-timeout.svg?branch=master
@@ -81,6 +80,13 @@
CHANGES
=======
+ 3.0.0 (2018-05-05)
+ ------------------
+
+ - Drop Python 3.4, the minimal supported version is Python 3.5.3
+
+ - Provide type annotations
+
2.0.1 (2018-03-13)
------------------
@@ -145,8 +151,8 @@
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: AsyncIO
+Requires-Python: >=3.5.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/async_timeout/__init__.py
new/async-timeout-3.0.0/async_timeout/__init__.py
--- old/async-timeout-2.0.1/async_timeout/__init__.py 2018-03-13
10:44:39.000000000 +0100
+++ new/async-timeout-3.0.0/async_timeout/__init__.py 2018-05-05
12:34:36.000000000 +0200
@@ -1,8 +1,11 @@
import asyncio
import sys
+from types import TracebackType
+from typing import Optional, Type
-__version__ = '2.0.1'
+
+__version__ = '3.0.0'
PY_37 = sys.version_info >= (3, 7)
@@ -21,42 +24,48 @@
timeout - value in seconds or None to disable timeout logic
loop - asyncio compatible event loop
"""
- def __init__(self, timeout, *, loop=None):
+ def __init__(self, timeout: Optional[float],
+ *, loop: asyncio.AbstractEventLoop=None) -> None:
self._timeout = timeout
if loop is None:
loop = asyncio.get_event_loop()
self._loop = loop
- self._task = None
+ self._task = None # type: Optional[asyncio.Task]
self._cancelled = False
- self._cancel_handler = None
- self._cancel_at = None
+ self._cancel_handler = None # type: Optional[asyncio.Handle]
+ self._cancel_at = None # type: Optional[float]
- def __enter__(self):
+ def __enter__(self) -> 'timeout':
return self._do_enter()
- def __exit__(self, exc_type, exc_val, exc_tb):
+ def __exit__(self,
+ exc_type: Type[BaseException],
+ exc_val: BaseException,
+ exc_tb: TracebackType) -> Optional[bool]:
self._do_exit(exc_type)
+ return None
- @asyncio.coroutine
- def __aenter__(self):
+ async def __aenter__(self) -> 'timeout':
return self._do_enter()
- @asyncio.coroutine
- def __aexit__(self, exc_type, exc_val, exc_tb):
+ async def __aexit__(self,
+ exc_type: Type[BaseException],
+ exc_val: BaseException,
+ exc_tb: TracebackType) -> None:
self._do_exit(exc_type)
@property
- def expired(self):
+ def expired(self) -> bool:
return self._cancelled
@property
- def remaining(self):
+ def remaining(self) -> Optional[float]:
if self._cancel_at is not None:
return max(self._cancel_at - self._loop.time(), 0.0)
else:
return None
- def _do_enter(self):
+ def _do_enter(self) -> 'timeout':
# Support Tornado 5- without timeout
# Details: https://github.com/python/asyncio/issues/392
if self._timeout is None:
@@ -76,7 +85,7 @@
self._cancel_at, self._cancel_task)
return self
- def _do_exit(self, exc_type):
+ def _do_exit(self, exc_type: Type[BaseException]) -> None:
if exc_type is asyncio.CancelledError and self._cancelled:
self._cancel_handler = None
self._task = None
@@ -85,20 +94,22 @@
self._cancel_handler.cancel()
self._cancel_handler = None
self._task = None
+ return None
- def _cancel_task(self):
- self._task.cancel()
- self._cancelled = True
+ def _cancel_task(self) -> None:
+ if self._task is not None:
+ self._task.cancel()
+ self._cancelled = True
-def current_task(loop):
+def current_task(loop: asyncio.AbstractEventLoop) -> asyncio.Task:
if PY_37:
- task = asyncio.current_task(loop=loop)
+ task = asyncio.current_task(loop=loop) # type: ignore
else:
task = asyncio.Task.current_task(loop=loop)
if task is None:
# this should be removed, tokio must use register_task and family API
if hasattr(loop, 'current_task'):
- task = loop.current_task()
+ task = loop.current_task() # type: ignore
return task
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/async_timeout/py.typed
new/async-timeout-3.0.0/async_timeout/py.typed
--- old/async-timeout-2.0.1/async_timeout/py.typed 1970-01-01
01:00:00.000000000 +0100
+++ new/async-timeout-3.0.0/async_timeout/py.typed 2018-05-05
12:34:36.000000000 +0200
@@ -0,0 +1 @@
+Placeholder
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/async_timeout.egg-info/PKG-INFO
new/async-timeout-3.0.0/async_timeout.egg-info/PKG-INFO
--- old/async-timeout-2.0.1/async_timeout.egg-info/PKG-INFO 2018-03-13
10:45:12.000000000 +0100
+++ new/async-timeout-3.0.0/async_timeout.egg-info/PKG-INFO 2018-05-05
12:35:13.000000000 +0200
@@ -1,12 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
Name: async-timeout
-Version: 2.0.1
+Version: 3.0.0
Summary: Timeout context manager for asyncio programs
Home-page: https://github.com/aio-libs/async_timeout/
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
-Description-Content-Type: UNKNOWN
Description: async-timeout
=============
.. image::
https://travis-ci.org/aio-libs/async-timeout.svg?branch=master
@@ -81,6 +80,13 @@
CHANGES
=======
+ 3.0.0 (2018-05-05)
+ ------------------
+
+ - Drop Python 3.4, the minimal supported version is Python 3.5.3
+
+ - Provide type annotations
+
2.0.1 (2018-03-13)
------------------
@@ -145,8 +151,8 @@
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: AsyncIO
+Requires-Python: >=3.5.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/async-timeout-2.0.1/async_timeout.egg-info/SOURCES.txt
new/async-timeout-3.0.0/async_timeout.egg-info/SOURCES.txt
--- old/async-timeout-2.0.1/async_timeout.egg-info/SOURCES.txt 2018-03-13
10:45:12.000000000 +0100
+++ new/async-timeout-3.0.0/async_timeout.egg-info/SOURCES.txt 2018-05-05
12:35:13.000000000 +0200
@@ -5,6 +5,7 @@
setup.cfg
setup.py
async_timeout/__init__.py
+async_timeout/py.typed
async_timeout.egg-info/PKG-INFO
async_timeout.egg-info/SOURCES.txt
async_timeout.egg-info/dependency_links.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/setup.cfg
new/async-timeout-3.0.0/setup.cfg
--- old/async-timeout-2.0.1/setup.cfg 2018-03-13 10:45:12.000000000 +0100
+++ new/async-timeout-3.0.0/setup.cfg 2018-05-05 12:35:13.000000000 +0200
@@ -1,6 +1,12 @@
[tool:pytest]
addopts = --cov=async_timeout --cov-report=term --cov-report=html --cov-branch
+[metadata]
+license_file = LICENSE
+
+[mypy-pytest]
+ignore_missing_imports = true
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/setup.py
new/async-timeout-3.0.0/setup.py
--- old/async-timeout-2.0.1/setup.py 2018-03-13 10:44:39.000000000 +0100
+++ new/async-timeout-3.0.0/setup.py 2018-05-05 12:34:36.000000000 +0200
@@ -1,5 +1,6 @@
import pathlib
import re
+import sys
from setuptools import setup
@@ -29,7 +30,6 @@
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP',
@@ -40,4 +40,5 @@
url='https://github.com/aio-libs/async_timeout/',
license='Apache 2',
packages=['async_timeout'],
- include_package_data=False)
+ python_requires='>=3.5.3',
+ include_package_data=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/tests/conftest.py
new/async-timeout-3.0.0/tests/conftest.py
--- old/async-timeout-2.0.1/tests/conftest.py 2018-03-13 10:44:39.000000000
+0100
+++ new/async-timeout-3.0.0/tests/conftest.py 2018-05-05 12:34:36.000000000
+0200
@@ -1,7 +1,6 @@
-import sys
+import pytest
-def pytest_ignore_collect(path, config):
- if 'py35' in str(path):
- if sys.version_info < (3, 5, 0):
- return True
[email protected]
+def loop(event_loop):
+ return event_loop
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/tests/test_py35.py
new/async-timeout-3.0.0/tests/test_py35.py
--- old/async-timeout-2.0.1/tests/test_py35.py 2018-03-13 10:44:39.000000000
+0100
+++ new/async-timeout-3.0.0/tests/test_py35.py 2018-05-05 12:34:36.000000000
+0200
@@ -4,6 +4,8 @@
from async_timeout import timeout
+pytestmark = pytest.mark.asyncio
+
async def test_async_timeout(loop):
with pytest.raises(asyncio.TimeoutError):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/async-timeout-2.0.1/tests/test_timeout.py
new/async-timeout-3.0.0/tests/test_timeout.py
--- old/async-timeout-2.0.1/tests/test_timeout.py 2018-03-13
10:44:39.000000000 +0100
+++ new/async-timeout-3.0.0/tests/test_timeout.py 2018-05-05
12:34:36.000000000 +0200
@@ -21,14 +21,13 @@
return asyncio.Future(loop=loop)
[email protected]
-def test_timeout(loop):
[email protected]
+async def test_timeout(loop):
canceled_raised = False
- @asyncio.coroutine
- def long_running_task():
+ async def long_running_task():
try:
- yield from asyncio.sleep(10, loop=loop)
+ await asyncio.sleep(10, loop=loop)
except asyncio.CancelledError:
nonlocal canceled_raised
canceled_raised = True
@@ -36,45 +35,42 @@
with pytest.raises(asyncio.TimeoutError):
with timeout(0.01, loop=loop) as t:
- yield from long_running_task()
+ await long_running_task()
assert t._loop is loop
assert canceled_raised, 'CancelledError was not raised'
[email protected]
-def test_timeout_finish_in_time(loop):
- @asyncio.coroutine
- def long_running_task():
- yield from asyncio.sleep(0.01, loop=loop)
[email protected]
+async def test_timeout_finish_in_time(loop):
+ async def long_running_task():
+ await asyncio.sleep(0.01, loop=loop)
return 'done'
with timeout(0.1, loop=loop):
- resp = yield from long_running_task()
+ resp = await long_running_task()
assert resp == 'done'
def test_timeout_global_loop(loop):
asyncio.set_event_loop(loop)
- @asyncio.coroutine
- def run():
+ async def run():
with timeout(10) as t:
- yield from asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
assert t._loop is loop
loop.run_until_complete(run())
[email protected]
-def test_timeout_disable(loop):
- @asyncio.coroutine
- def long_running_task():
- yield from asyncio.sleep(0.1, loop=loop)
[email protected]
+async def test_timeout_disable(loop):
+ async def long_running_task():
+ await asyncio.sleep(0.1, loop=loop)
return 'done'
t0 = loop.time()
with timeout(None, loop=loop):
- resp = yield from long_running_task()
+ resp = await long_running_task()
assert resp == 'done'
dt = loop.time() - t0
assert 0.09 < dt < 0.13, dt
@@ -85,72 +81,70 @@
assert cm._task is None
[email protected]
-def test_timeout_enable_zero(loop):
[email protected]
+async 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)
+ await asyncio.sleep(0.1, loop=loop)
assert cm.expired
[email protected]
-def test_timeout_enable_zero_coro_not_started(loop):
[email protected]
+async def test_timeout_enable_zero_coro_not_started(loop):
coro_started = False
- @asyncio.coroutine
- def coro():
+ async def coro():
nonlocal coro_started
coro_started = True
with pytest.raises(asyncio.TimeoutError):
with timeout(0, loop=loop) as cm:
- yield from asyncio.sleep(0, loop=loop)
- yield from coro()
+ await asyncio.sleep(0, loop=loop)
+ await coro()
assert cm.expired
assert coro_started is False
[email protected]
-def test_timeout_not_relevant_exception(loop):
- yield from asyncio.sleep(0, loop=loop)
[email protected]
+async def test_timeout_not_relevant_exception(loop):
+ await asyncio.sleep(0, loop=loop)
with pytest.raises(KeyError):
with timeout(0.1, loop=loop):
raise KeyError
[email protected]
-def test_timeout_canceled_error_is_not_converted_to_timeout(loop):
- yield from asyncio.sleep(0, loop=loop)
[email protected]
+async def test_timeout_canceled_error_is_not_converted_to_timeout(loop):
+ await asyncio.sleep(0, loop=loop)
with pytest.raises(asyncio.CancelledError):
with timeout(0.001, loop=loop):
raise asyncio.CancelledError
[email protected]
-def test_timeout_blocking_loop(loop):
- @asyncio.coroutine
- def long_running_task():
[email protected]
+async def test_timeout_blocking_loop(loop):
+ async def long_running_task():
time.sleep(0.1)
return 'done'
with timeout(0.01, loop=loop):
- result = yield from long_running_task()
+ result = await long_running_task()
assert result == 'done'
[email protected]
-def test_for_race_conditions(loop):
[email protected]
+async def test_for_race_conditions(loop):
fut = create_future(loop)
loop.call_later(0.1, fut.set_result('done'))
with timeout(0.2, loop=loop):
- resp = yield from fut
+ resp = await fut
assert resp == 'done'
[email protected]
-def test_timeout_time(loop):
[email protected]
+async def test_timeout_time(loop):
foo_running = None
start = loop.time()
@@ -158,7 +152,7 @@
with timeout(0.1, loop=loop):
foo_running = True
try:
- yield from asyncio.sleep(0.2, loop=loop)
+ await asyncio.sleep(0.2, loop=loop)
finally:
foo_running = False
@@ -175,79 +169,77 @@
pass
[email protected]
-def test_outer_coro_is_not_cancelled(loop):
[email protected]
+async def test_outer_coro_is_not_cancelled(loop):
has_timeout = False
- @asyncio.coroutine
- def outer():
+ async def outer():
nonlocal has_timeout
try:
with timeout(0.001, loop=loop):
- yield from asyncio.sleep(1, loop=loop)
+ await asyncio.sleep(1, loop=loop)
except asyncio.TimeoutError:
has_timeout = True
task = ensure_future(outer(), loop=loop)
- yield from task
+ await task
assert has_timeout
assert not task.cancelled()
assert task.done()
[email protected]
-def test_cancel_outer_coro(loop):
[email protected]
+async def test_cancel_outer_coro(loop):
fut = create_future(loop)
- @asyncio.coroutine
- def outer():
+ async def outer():
fut.set_result(None)
- yield from asyncio.sleep(1, loop=loop)
+ await asyncio.sleep(1, loop=loop)
task = ensure_future(outer(), loop=loop)
- yield from fut
+ await fut
task.cancel()
with pytest.raises(asyncio.CancelledError):
- yield from task
+ await task
assert task.cancelled()
assert task.done()
[email protected]
-def test_timeout_suppress_exception_chain(loop):
[email protected]
+async def test_timeout_suppress_exception_chain(loop):
with pytest.raises(asyncio.TimeoutError) as ctx:
with timeout(0.01, loop=loop):
- yield from asyncio.sleep(10, loop=loop)
+ await asyncio.sleep(10, loop=loop)
assert not ctx.value.__suppress_context__
[email protected]
-def test_timeout_expired(loop):
[email protected]
+async def test_timeout_expired(loop):
with pytest.raises(asyncio.TimeoutError):
with timeout(0.01, loop=loop) as cm:
- yield from asyncio.sleep(10, loop=loop)
+ await asyncio.sleep(10, loop=loop)
assert cm.expired
[email protected]
-def test_timeout_inner_timeout_error(loop):
[email protected]
+async def test_timeout_inner_timeout_error(loop):
with pytest.raises(asyncio.TimeoutError):
with timeout(0.01, loop=loop) as cm:
raise asyncio.TimeoutError
assert not cm.expired
[email protected]
-def test_timeout_inner_other_error(loop):
[email protected]
+async def test_timeout_inner_other_error(loop):
with pytest.raises(RuntimeError):
with timeout(0.01, loop=loop) as cm:
raise RuntimeError
assert not cm.expired
[email protected]
-def test_timeout_remaining(loop):
[email protected]
+async def test_timeout_remaining(loop):
with timeout(None, loop=loop) as cm:
assert cm.remaining is None
@@ -255,11 +247,17 @@
assert t.remaining is None
with timeout(1.0, loop=loop) as cm:
- yield from asyncio.sleep(0.1, loop=loop)
+ await asyncio.sleep(0.1, loop=loop)
assert cm.remaining < 1.0
with pytest.raises(asyncio.TimeoutError):
with timeout(0.1, loop=loop) as cm:
- yield from asyncio.sleep(0.5, loop=loop)
+ await asyncio.sleep(0.5, loop=loop)
assert cm.remaining == 0.0
+
+
+def test_cancel_without_starting(loop):
+ tm = timeout(1, loop=loop)
+ tm._cancel_task()
+ tm._cancel_task() # double call should success