Skip to content

Instantly share code, notes, and snippets.

View FinchPowers's full-sized avatar

François-Michel L'Heureux FinchPowers

View GitHub Profile
@pytest.fixture
def capture_logging() -> Generator[StringIO, None, None]:
sio = StringIO()
sh = StreamHandler(stream=sio)
log.addHandler(sh)
yield sio
log.removeHandler(sh)