Skip to content

Commit 7ae10e8

Browse files
authored
Don't suppress nested exception (#13)
* Don't suppress nested exception * Update CHANGES * Drop redundant check * Tune requirements * Add missing file
1 parent db36306 commit 7ae10e8

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ python:
66

77
install:
88
- pip install -e .
9-
- pip install docutils
9+
- pip install -r requirements.txt
1010
- pip install codecov
11-
- pip install pytest
12-
- pip install pytest_aiohttp
13-
- pip install pytest-runner
1411

1512
script:
16-
- python -m pytest tests
13+
- pytest tests
1714
- python setup.py check -rm
1815
- if python -c "import sys; sys.exit(sys.version_info < (3,5))"; then
1916
python setup.py check -s;

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGES
22
=======
33

4+
1.3.0 (2017-xx-xx)
5+
------------------
6+
7+
* Don't suppress nested exception on timeout. Exception context points
8+
on cancelled line with suspended `await` (#13)
9+
410
1.2.1 (2017-05-02)
511
------------------
612

async_timeout/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
4343
if exc_type is asyncio.CancelledError and self._cancelled:
4444
self._cancel_handler = None
4545
self._task = None
46-
raise asyncio.TimeoutError from None
46+
raise asyncio.TimeoutError
4747
if self._timeout is not None and self._cancel_handler is not None:
4848
self._cancel_handler.cancel()
4949
self._cancel_handler = None

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pytest==3.2.1
2+
pytest-aiohttp==0.1.3
3+
docutils==0.14

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,4 @@ def read(name):
4040
url='https://github.com/aio-libs/async_timeout/',
4141
license='Apache 2',
4242
packages=['async_timeout'],
43-
setup_requires=[],
44-
tests_require=['pytest', 'pytest_aiohttp', 'pytest-runner'],
4543
include_package_data=False)

tests/test_timeout.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ def outer():
201201
def test_timeout_suppress_exception_chain(loop):
202202

203203
with pytest.raises(asyncio.TimeoutError) as ctx:
204-
with timeout(0.01, loop=loop) as t:
204+
with timeout(0.01, loop=loop):
205205
yield from asyncio.sleep(10, loop=loop)
206-
assert t._loop is loop
207-
assert ctx.value.__suppress_context__
206+
assert not ctx.value.__suppress_context__

0 commit comments

Comments
 (0)