diff --git a/tests/conftest.py b/tests/conftest.py
index 01607484d70917caa3009186a4a61fb2783f1e44..4e720bc0bd2c7117960077a1d6f55fe7e6337e5a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -26,6 +26,7 @@ from aiohttp.test_utils import (
 )
 from aiohttp.typedefs import JSONDecoder
 from aiohttp.web import Application
+import bcrypt
 import freezegun
 import multidict
 import pytest
@@ -70,6 +71,7 @@ from homeassistant.helpers import (
     recorder as recorder_helper,
 )
 from homeassistant.helpers.dispatcher import async_dispatcher_send
+from homeassistant.helpers.translation import _TranslationsCacheData
 from homeassistant.helpers.typing import ConfigType
 from homeassistant.setup import BASE_PLATFORMS, async_setup_component
 from homeassistant.util import location
@@ -394,8 +396,6 @@ def reset_hass_threading_local_object() -> Generator[None]:
 @pytest.fixture(scope="session", autouse=True)
 def bcrypt_cost() -> Generator[None]:
     """Run with reduced rounds during tests, to speed up uses."""
-    import bcrypt
-
     gensalt_orig = bcrypt.gensalt
 
     def gensalt_mock(rounds=12, prefix=b"2b"):
@@ -1174,8 +1174,6 @@ def mock_get_source_ip() -> Generator[_patch]:
 @pytest.fixture(autouse=True, scope="session")
 def translations_once() -> Generator[_patch]:
     """Only load translations once per session."""
-    from homeassistant.helpers.translation import _TranslationsCacheData
-
     cache = _TranslationsCacheData({}, {})
     patcher = patch(
         "homeassistant.helpers.translation._TranslationsCacheData",
diff --git a/tests/helpers/test_frame.py b/tests/helpers/test_frame.py
index e6251963d3647f06be28c23523e0bfb0de17191d..b0b4a0be6ee614e5b7639322cdf2ec06e8201450 100644
--- a/tests/helpers/test_frame.py
+++ b/tests/helpers/test_frame.py
@@ -36,6 +36,7 @@ async def test_extract_frame_resolve_module(
     hass: HomeAssistant, enable_custom_integrations
 ) -> None:
     """Test extracting the current frame from integration context."""
+    # pylint: disable-next=import-outside-toplevel
     from custom_components.test_integration_frame import call_get_integration_frame
 
     integration_frame = call_get_integration_frame()
@@ -53,6 +54,7 @@ async def test_get_integration_logger_resolve_module(
     hass: HomeAssistant, enable_custom_integrations
 ) -> None:
     """Test getting the logger from integration context."""
+    # pylint: disable-next=import-outside-toplevel
     from custom_components.test_integration_frame import call_get_integration_logger
 
     logger = call_get_integration_logger(__name__)
diff --git a/tests/helpers/test_sun.py b/tests/helpers/test_sun.py
index da436d799aa56da5f92ba13cdf331e3ab7d6b638..54c26997422c9346c3a376567d75b495a57d2624 100644
--- a/tests/helpers/test_sun.py
+++ b/tests/helpers/test_sun.py
@@ -2,6 +2,8 @@
 
 from datetime import datetime, timedelta
 
+from astral import LocationInfo
+import astral.sun
 from freezegun import freeze_time
 import pytest
 
@@ -14,8 +16,6 @@ import homeassistant.util.dt as dt_util
 def test_next_events(hass: HomeAssistant) -> None:
     """Test retrieving next sun events."""
     utc_now = datetime(2016, 11, 1, 8, 0, 0, tzinfo=dt_util.UTC)
-    from astral import LocationInfo
-    import astral.sun
 
     utc_today = utc_now.date()
 
@@ -89,8 +89,6 @@ def test_next_events(hass: HomeAssistant) -> None:
 def test_date_events(hass: HomeAssistant) -> None:
     """Test retrieving next sun events."""
     utc_now = datetime(2016, 11, 1, 8, 0, 0, tzinfo=dt_util.UTC)
-    from astral import LocationInfo
-    import astral.sun
 
     utc_today = utc_now.date()
 
@@ -116,8 +114,6 @@ def test_date_events(hass: HomeAssistant) -> None:
 def test_date_events_default_date(hass: HomeAssistant) -> None:
     """Test retrieving next sun events."""
     utc_now = datetime(2016, 11, 1, 8, 0, 0, tzinfo=dt_util.UTC)
-    from astral import LocationInfo
-    import astral.sun
 
     utc_today = utc_now.date()
 
@@ -144,8 +140,6 @@ def test_date_events_default_date(hass: HomeAssistant) -> None:
 def test_date_events_accepts_datetime(hass: HomeAssistant) -> None:
     """Test retrieving next sun events."""
     utc_now = datetime(2016, 11, 1, 8, 0, 0, tzinfo=dt_util.UTC)
-    from astral import LocationInfo
-    import astral.sun
 
     utc_today = utc_now.date()