diff --git a/pyproject.toml b/pyproject.toml index 1a06bd63726..cb23a3e5313 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/script/ruff.toml b/script/ruff.toml index c32b39022cc..a14712ec142 100644 --- a/script/ruff.toml +++ b/script/ruff.toml @@ -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" diff --git a/tests/ruff.toml b/tests/ruff.toml index bbfbfe1305d..c56b8f68ffc 100644 --- a/tests/ruff.toml +++ b/tests/ruff.toml @@ -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",