conftest.py
This file
Path
tests/requests_compat/conftest.py
17 lines · 463 bytes · Python
Last changed by
Test Requests entrypoints (#330)Florimond Mancabefore adoptionf1dde95
History of this fileTake it
1import sys23import pytest45import httpx678def pytest_configure(config):9 # Allow to 'import requests' without having to write 'import httpx as requests'.10 # This means we *could* literally copy-paste Requests test code as-is, if relevant.11 sys.modules["requests"] = httpx121314@pytest.fixture(autouse=True)15def patch_httpx(monkeypatch):16 """Monkey-patch Requests APIs onto HTTPX."""17 monkeypatch.setattr(httpx, "session", httpx.Client, raising=False)