Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skipping tests requiring httptools #1538

Merged
merged 1 commit into from Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/middleware/test_logging.py
Expand Up @@ -7,6 +7,15 @@

from tests.utils import run_server
from uvicorn import Config
from uvicorn.protocols.http.h11_impl import H11Protocol

try:
from uvicorn.protocols.http.httptools_impl import HttpToolsProtocol
except ImportError: # pragma: nocover
HttpToolsProtocol = None


HTTP_PROTOCOLS = [p for p in [H11Protocol, HttpToolsProtocol] if p is not None]
euri10 marked this conversation as resolved.
Show resolved Hide resolved


@contextlib.contextmanager
Expand Down Expand Up @@ -49,7 +58,7 @@ async def test_trace_logging(caplog, logging_config):


@pytest.mark.anyio
@pytest.mark.parametrize("http_protocol", [("h11"), ("httptools")])
@pytest.mark.parametrize("http_protocol", HTTP_PROTOCOLS)
euri10 marked this conversation as resolved.
Show resolved Hide resolved
async def test_trace_logging_on_http_protocol(http_protocol, caplog, logging_config):
config = Config(
app=app,
Expand Down
1 change: 1 addition & 0 deletions tests/protocols/test_http.py
Expand Up @@ -766,6 +766,7 @@ async def test_invalid_http_request(request_line, protocol_cls, caplog):
assert b"Invalid HTTP request received." in protocol.transport.buffer


@pytest.mark.skipif(HttpToolsProtocol is None, reason="httptools is not installed")
def test_fragmentation():
Kludex marked this conversation as resolved.
Show resolved Hide resolved
def receive_all(sock):
chunks = []
Expand Down