From: Tom Christie Date: Thu, 16 May 2019 10:14:21 +0000 (+0100) Subject: 100% test coverage (#71) X-Git-Tag: 0.3.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc16d31d621fe4a93ea266af9da53d76c44b9f4d;p=thirdparty%2Fhttpx.git 100% test coverage (#71) --- diff --git a/httpcore/concurrency.py b/httpcore/concurrency.py index 3e63d858..fb20d7c5 100644 --- a/httpcore/concurrency.py +++ b/httpcore/concurrency.py @@ -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: diff --git a/scripts/test b/scripts/test index 20009184..221e1d3d 100755 --- a/scripts/test +++ b/scripts/test @@ -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 diff --git a/tests/test_timeouts.py b/tests/test_timeouts.py index 17a16935..d0cb9b21 100644 --- a/tests/test_timeouts.py +++ b/tests/test_timeouts.py @@ -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)