]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Don't check trio import in definition of backend fixture params (#447)
authorFlorimond Manca <florimond.manca@gmail.com>
Sun, 6 Oct 2019 00:12:06 +0000 (02:12 +0200)
committerSeth Michael Larson <sethmichaellarson@gmail.com>
Sun, 6 Oct 2019 00:12:06 +0000 (19:12 -0500)
tests/conftest.py

index ed9ea34b8f8a5c4da622ce9fa4f5ad0e21ead805..c6968894d53af0602c82d3fd291803396c85ec90 100644 (file)
@@ -18,6 +18,7 @@ from uvicorn.config import Config
 from uvicorn.main import Server
 
 from httpx import URL, AsyncioBackend
+from httpx.concurrency.trio import TrioBackend
 
 ENVIRONMENT_VARIABLES = {
     "SSL_CERT_FILE",
@@ -47,17 +48,12 @@ def clean_environ() -> typing.Dict[str, typing.Any]:
     os.environ.update(original_environ)
 
 
-backend_params = [pytest.param(AsyncioBackend, marks=pytest.mark.asyncio)]
-
-try:
-    from httpx.concurrency.trio import TrioBackend
-except ImportError:  # pragma: no cover
-    pass
-else:
-    backend_params.append(pytest.param(TrioBackend, marks=pytest.mark.trio))
-
-
-@pytest.fixture(params=backend_params)
+@pytest.fixture(
+    params=[
+        pytest.param(AsyncioBackend, marks=pytest.mark.asyncio),
+        pytest.param(TrioBackend, marks=pytest.mark.trio),
+    ]
+)
 def backend(request):
     backend_cls = request.param
     return backend_cls()