1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import logging
from logging import Logger

import pytest
from _pytest.fixtures import FixtureRequest


@pytest.fixture
def logger(request: FixtureRequest) -> Logger:
    """
    Returns a logger object to use in a test function.
    :param request: provide by pytest, information about where this fixture was used
    :return: a logger object to use
    """
    return logging.getLogger(request.function.__name__)