Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ trio-typing==0.10.0
trustme==1.1.0; python_version < '3.9'
trustme==1.2.0; python_version >= '3.9'
uvicorn==0.32.1
blockbuster==1.5.23
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pytest
import trustme
from blockbuster import blockbuster_ctx
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import (
BestAvailableEncryption,
Expand All @@ -31,6 +32,13 @@
}


@pytest.fixture(autouse=True)
def blockbuster():
with blockbuster_ctx() as bb:
bb.functions["os.stat"].can_block_in("/mimetypes.py", "init")
yield bb


@pytest.fixture(scope="function", autouse=True)
def clean_environ():
"""Keeps os.environ clean for every test without having to mock os.environ"""
Expand Down
4 changes: 3 additions & 1 deletion tests/models/test_whatwg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
# https://url.spec.whatwg.org/

import json
from pathlib import Path

import pytest

from httpx._urlparse import urlparse

# URL test cases from...
# https://github.com/web-platform-tests/wpt/blob/master/url/resources/urltestdata.json
with open("tests/models/whatwg.json", "r", encoding="utf-8") as input:
whatwg_path = Path(__file__).parent.parent / "models" / "whatwg.json"
with whatwg_path.open("r", encoding="utf-8") as input:
test_cases = json.load(input)
test_cases = [
item
Expand Down