Add pytest-style linting (#159)

This does mean we need to tell pyright that the init_cache auto-use
fixture is still being used even though it now has a leading underscore.
This commit is contained in:
Martijn Pieters
2023-05-16 13:45:26 +01:00
committed by GitHub
parent 230c24a4e0
commit 23bb4e9cd4
2 changed files with 4 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
[tool.ruff] [tool.ruff]
extend = "../pyproject.toml" extend = "../pyproject.toml"
extend-select = [
"PT", # flake8-pytest-style
]
ignore = ["S101"] ignore = ["S101"]
[tool.ruff.isort] [tool.ruff.isort]

View File

@@ -11,7 +11,7 @@ from fastapi_cache.backends.inmemory import InMemoryBackend
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def init_cache() -> Generator[Any, Any, None]: def _init_cache() -> Generator[Any, Any, None]: # pyright: ignore[reportUnusedFunction]
FastAPICache.init(InMemoryBackend()) FastAPICache.init(InMemoryBackend())
yield yield
FastAPICache.reset() FastAPICache.reset()