Skip to content
Myr

utils.py

This file

Path

tests/utils.py

20 lines · 463 bytes · Python

Last changed by

Add `httpx.MockTransport()` (#1401)Tom Christiebefore adoption9c7c2ac

History of this file

Take it

The walk stopped after 200 commits: lines older than 9200cb0 point at it.

chore: direct questions towards Gitter chat (#1225)Moritz E. Beberbefore adoption9200cb0

lines 1–20why, one step back
1import contextlib
2import logging3import os45from httpx import _utils678@contextlib.contextmanager9def override_log_level(log_level: str):10 os.environ["HTTPX_LOG_LEVEL"] = log_level1112 # Force a reload on the logging handlers13 _utils._LOGGER_INITIALIZED = False14 _utils.get_logger("httpx")1516 try:17 yield18 finally:19 # Reset the logger so we don't have verbose output in all unit tests20 logging.getLogger("httpx").handlers = []