Prevent imports from tests in core codebase (#133928)

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
pull/133936/head
Franck Nijhof 2024-12-24 08:40:05 +01:00 committed by GitHub
parent 2d5e2aa4b4
commit 771ead9d7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -904,6 +904,7 @@ mark-parentheses = false
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"async_timeout".msg = "use asyncio.timeout instead"
"pytz".msg = "use zoneinfo instead"
"tests".msg = "You should not import tests"
[tool.ruff.lint.isort]
force-sort-within-sections = true

View File

@ -5,3 +5,7 @@ extend = "../pyproject.toml"
forced-separate = [
"tests",
]
[lint.flake8-tidy-imports.banned-api]
"async_timeout".msg = "use asyncio.timeout instead"
"pytz".msg = "use zoneinfo instead"

View File

@ -10,6 +10,10 @@ extend-ignore = [
"SLF001", # Private member accessed: Tests do often test internals a lot
]
[lint.flake8-tidy-imports.banned-api]
"async_timeout".msg = "use asyncio.timeout instead"
"pytz".msg = "use zoneinfo instead"
[lint.isort]
known-first-party = [
"homeassistant",