Skip to content
Myr

100% test coverage (#71)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by GitHub · parent b8b3714 · Browse files · 3 files+7 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+7 added−7 removed

  • tests:+5 added−5 removed
  • other:+2 added−2 removed

3 files+7 added−7 removed

modified:httpcore/concurrency.py+1 added-1 removed
74 unmodified lines
75 self.stream_writer = stream_writer76 self.timeout = timeout7778 def write_no_block(self, data: bytes) -> None:79 self.stream_writer.write(data)79 self.stream_writer.write(data) # pragma: nocover8081 async def write(self, data: bytes, timeout: OptionalTimeout = None) -> None:82 if not data:83 return
86 unmodified lines
modified:scripts/test+1 added-1 removed
6 unmodified lines
7fi89set -x1011PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov tests --cov ${PACKAGE} --cov-report= ${@}11PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov tests --cov ${PACKAGE} --cov-report= --cov-fail-under=100 ${@}12${PREFIX}coverage report -m
modified:tests/test_timeouts.py+5 added-5 removed
11 unmodified lines
121314@pytest.mark.asyncio15async def test_read_timeout(server):16 timeout = TimeoutConfig(read_timeout=0.0001)16 timeout = TimeoutConfig(read_timeout=0.000001)1718 async with AsyncClient(timeout=timeout) as client:19 with pytest.raises(ReadTimeout):20 await client.get("http://127.0.0.1:8000/slow_response")212223@pytest.mark.asyncio24async def test_write_timeout(server):25 timeout = TimeoutConfig(write_timeout=0.0001)25 timeout = TimeoutConfig(write_timeout=0.000001)2627 async with AsyncClient(timeout=timeout) as client:28 with pytest.raises(WriteTimeout):29 data = b"*" * 1024 * 1024 * 1029 data = b"*" * 1024 * 1024 * 10030 await client.put("http://127.0.0.1:8000/slow_response", data=data)313233@pytest.mark.asyncio34async def test_connect_timeout(server):35 timeout = TimeoutConfig(connect_timeout=0.0001)35 timeout = TimeoutConfig(connect_timeout=0.000001)3637 async with AsyncClient(timeout=timeout) as client:38 with pytest.raises(ConnectTimeout):39 # See https://stackoverflow.com/questions/100841/
1 unmodified line
414243@pytest.mark.asyncio44async def test_pool_timeout(server):45 pool_limits = PoolLimits(hard_limit=1, pool_timeout=0.0001)45 pool_limits = PoolLimits(hard_limit=1, pool_timeout=0.000001)4647 async with AsyncClient(pool_limits=pool_limits) as client:48 response = await client.get("http://127.0.0.1:8000/", stream=True)49
4 unmodified lines