Skip to content

Commit 7db7d9b

Browse files
committed
Fixed coverage problems
1 parent ca3d6d0 commit 7db7d9b

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

httpcore/_models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,11 @@ async def aiter_stream(self) -> AsyncGenerator[bytes]:
486486
)
487487
self._stream_consumed = True
488488
async with AsyncExitStack() as stack:
489-
if isasyncgen(self.stream):
490-
stack.push_async_callback(self.stream.aclose)
489+
iterator = self.stream.__aiter__()
490+
if isasyncgen(iterator):
491+
stack.push_async_callback(iterator.aclose)
491492

492-
async for chunk in self.stream:
493+
async for chunk in iterator:
493494
yield chunk
494495

495496
async def aclose(self) -> None:

httpcore/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import socket
55
import sys
66

7-
if sys.version_info >= (3, 10):
7+
if sys.version_info >= (3, 10): # pragma: no cover
88
from contextlib import aclosing as aclosing
9-
else:
9+
else: # pragma: no cover
1010
from contextlib import AbstractAsyncContextManager
1111
from typing import Any, Awaitable, Protocol, TypeVar
1212

tests/test_models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ async def __aiter__(self) -> typing.AsyncIterator[bytes]:
163163
for chunk in self._chunks:
164164
yield chunk
165165

166-
async def aclose(self) -> None:
167-
pass
168-
169166

170167
@pytest.mark.trio
171168
async def test_response_async_read():

0 commit comments

Comments
 (0)