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 type hints #4

Merged
merged 2 commits into from
Oct 4, 2023
Merged
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
8 changes: 5 additions & 3 deletions src/pytest_loguru/plugin.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
from typing import Iterator # pragma: no cover

import pytest # pragma: no cover
from _pytest.logging import LogCaptureFixture # pragma: no cover
from loguru import logger # pragma: no cover


@pytest.fixture
def caplog(caplog: LogCaptureFixture) -> None:
def caplog(caplog: LogCaptureFixture) -> Iterator[LogCaptureFixture]:
"""Emitting logs from loguru's logger.log means that they will not show up in
caplog which only works with Python's standard logging. This adds the same
LogCaptureHandler being used by caplog to hook into loguru.

Args:
caplog (LogCaptureFixture): caplog fixture

Returns:
None
Yields:
LogCaptureFixture
"""

def filter_(record):
Expand Down