|
4 | 4 | import socket
|
5 | 5 | import ssl
|
6 | 6 | import sys
|
7 |
| -import zlib |
8 | 7 | from hashlib import md5, sha1, sha256
|
9 | 8 | from pathlib import Path
|
10 | 9 | from tempfile import TemporaryDirectory
|
11 | 10 | from typing import Any, AsyncIterator, Generator, Iterator
|
12 | 11 | from unittest import mock
|
13 | 12 | from uuid import uuid4
|
14 | 13 |
|
15 |
| -import isal.isal_zlib |
16 | 14 | import pytest
|
17 |
| -import zlib_ng.zlib_ng |
18 | 15 | from blockbuster import blockbuster_ctx
|
19 | 16 |
|
20 | 17 | from aiohttp import payload
|
@@ -251,6 +248,8 @@ def selector_loop() -> Iterator[asyncio.AbstractEventLoop]:
|
251 | 248 |
|
252 | 249 | @pytest.fixture
|
253 | 250 | def uvloop_loop() -> Iterator[asyncio.AbstractEventLoop]:
|
| 251 | + if uvloop is None: |
| 252 | + pytest.skip("uvloop is not installed") |
254 | 253 | factory = uvloop.new_event_loop
|
255 | 254 | with loop_context(factory) as _loop:
|
256 | 255 | asyncio.set_event_loop(_loop)
|
@@ -331,13 +330,13 @@ def unused_port_socket() -> Generator[socket.socket, None, None]:
|
331 | 330 | s.close()
|
332 | 331 |
|
333 | 332 |
|
334 |
| -@pytest.fixture(params=[zlib, zlib_ng.zlib_ng, isal.isal_zlib]) |
| 333 | +@pytest.fixture(params=["zlib", "zlib_ng.zlib_ng", "isal.isal_zlib"]) |
335 | 334 | def parametrize_zlib_backend(
|
336 | 335 | request: pytest.FixtureRequest,
|
337 | 336 | ) -> Generator[None, None, None]:
|
338 | 337 | original_backend: ZLibBackendProtocol = ZLibBackend._zlib_backend
|
339 |
| - set_zlib_backend(request.param) |
340 |
| - |
| 338 | + backend = pytest.importorskip(request.param) |
| 339 | + set_zlib_backend(backend) |
341 | 340 | yield
|
342 | 341 |
|
343 | 342 | set_zlib_backend(original_backend)
|
|
0 commit comments