File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1+ Restored the ``force_close `` method to the ``ResponseHandler `` -- by :user: `bdraco `.
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ def should_close(self) -> bool:
6060 or self ._tail
6161 )
6262
63+ def force_close (self ) -> None :
64+ self ._should_close = True
65+
6366 def close (self ) -> None :
6467 transport = self .transport
6568 if transport is not None :
Original file line number Diff line number Diff line change 1+ import asyncio
12from unittest import mock
23
34from yarl import URL
910from aiohttp .helpers import TimerNoop
1011
1112
12- async def test_oserror (loop ) -> None :
13+ async def test_force_close (loop : asyncio .AbstractEventLoop ) -> None :
14+ """Ensure that the force_close method sets the should_close attribute to True.
15+
16+ This is used externally in aiodocker
17+ https://github.com/aio-libs/aiodocker/issues/920
18+ """
19+ proto = ResponseHandler (loop = loop )
20+ proto .force_close ()
21+ assert proto .should_close
22+
23+
24+ async def test_oserror (loop : asyncio .AbstractEventLoop ) -> None :
1325 proto = ResponseHandler (loop = loop )
1426 transport = mock .Mock ()
1527 proto .connection_made (transport )
You can’t perform that action at this time.
0 commit comments