100% test coverage (#71)
This commit is contained in:
parent
b8b3714d8e
commit
fc16d31d62
@ -76,7 +76,7 @@ class Writer(BaseWriter):
|
||||
self.timeout = timeout
|
||||
|
||||
def write_no_block(self, data: bytes) -> None:
|
||||
self.stream_writer.write(data)
|
||||
self.stream_writer.write(data) # pragma: nocover
|
||||
|
||||
async def write(self, data: bytes, timeout: OptionalTimeout = None) -> None:
|
||||
if not data:
|
||||
|
||||
@ -8,5 +8,5 @@ fi
|
||||
|
||||
set -x
|
||||
|
||||
PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov tests --cov ${PACKAGE} --cov-report= ${@}
|
||||
PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov tests --cov ${PACKAGE} --cov-report= --cov-fail-under=100 ${@}
|
||||
${PREFIX}coverage report -m
|
||||
|
||||
@ -13,7 +13,7 @@ from httpcore import (
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_read_timeout(server):
|
||||
timeout = TimeoutConfig(read_timeout=0.0001)
|
||||
timeout = TimeoutConfig(read_timeout=0.000001)
|
||||
|
||||
async with AsyncClient(timeout=timeout) as client:
|
||||
with pytest.raises(ReadTimeout):
|
||||
@ -22,17 +22,17 @@ async def test_read_timeout(server):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_write_timeout(server):
|
||||
timeout = TimeoutConfig(write_timeout=0.0001)
|
||||
timeout = TimeoutConfig(write_timeout=0.000001)
|
||||
|
||||
async with AsyncClient(timeout=timeout) as client:
|
||||
with pytest.raises(WriteTimeout):
|
||||
data = b"*" * 1024 * 1024 * 10
|
||||
data = b"*" * 1024 * 1024 * 100
|
||||
await client.put("http://127.0.0.1:8000/slow_response", data=data)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_connect_timeout(server):
|
||||
timeout = TimeoutConfig(connect_timeout=0.0001)
|
||||
timeout = TimeoutConfig(connect_timeout=0.000001)
|
||||
|
||||
async with AsyncClient(timeout=timeout) as client:
|
||||
with pytest.raises(ConnectTimeout):
|
||||
@ -42,7 +42,7 @@ async def test_connect_timeout(server):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pool_timeout(server):
|
||||
pool_limits = PoolLimits(hard_limit=1, pool_timeout=0.0001)
|
||||
pool_limits = PoolLimits(hard_limit=1, pool_timeout=0.000001)
|
||||
|
||||
async with AsyncClient(pool_limits=pool_limits) as client:
|
||||
response = await client.get("http://127.0.0.1:8000/", stream=True)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user