Fix conftest for pylint plugin (#72777)

This commit is contained in:
Marc Mueller 2022-06-01 09:22:47 +02:00 committed by GitHub
parent 577be70da9
commit 4902af2f4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,17 +1,21 @@
"""Configuration for pylint tests.""" """Configuration for pylint tests."""
from importlib.machinery import SourceFileLoader from importlib.machinery import SourceFileLoader
from pathlib import Path
from types import ModuleType from types import ModuleType
from pylint.checkers import BaseChecker from pylint.checkers import BaseChecker
from pylint.testutils.unittest_linter import UnittestLinter from pylint.testutils.unittest_linter import UnittestLinter
import pytest import pytest
BASE_PATH = Path(__file__).parents[2]
@pytest.fixture(name="hass_enforce_type_hints")
@pytest.fixture(name="hass_enforce_type_hints", scope="session")
def hass_enforce_type_hints_fixture() -> ModuleType: def hass_enforce_type_hints_fixture() -> ModuleType:
"""Fixture to provide a requests mocker.""" """Fixture to provide a requests mocker."""
loader = SourceFileLoader( loader = SourceFileLoader(
"hass_enforce_type_hints", "pylint/plugins/hass_enforce_type_hints.py" "hass_enforce_type_hints",
str(BASE_PATH.joinpath("pylint/plugins/hass_enforce_type_hints.py")),
) )
return loader.load_module(None) return loader.load_module(None)