]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
100% test coverage (#71)
authorTom Christie <tom@tomchristie.com>
Thu, 16 May 2019 10:14:21 +0000 (11:14 +0100)
committerGitHub <noreply@github.com>
Thu, 16 May 2019 10:14:21 +0000 (11:14 +0100)
httpcore/concurrency.py
scripts/test
tests/test_timeouts.py

index 3e63d858baaead634f32cb7b8e82c198ba4bdb86..fb20d7c5f18aea6a480779b3fbf8ba27f44b9cfb 100644 (file)
@@ -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:
index 200091842a0bdce9deec7aca2872aa0544fbc94e..221e1d3d4eb22e54bc241bd0ca4270ad6ecf45ac 100755 (executable)
@@ -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
index 17a16935cef50359d61bfe11875c0e1661771c35..d0cb9b215c084f8afa1845ace03863a5389c31a8 100644 (file)
@@ -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)