From 7ec2980e52746328288f13fc61ae7f55d9779279 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 1 Dec 2023 07:14:13 +0100 Subject: [PATCH] Change pytest fixture scope from core fixtures (#104831) --- tests/components/conftest.py | 2 +- tests/conftest.py | 4 ++-- tests/test_bootstrap.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/components/conftest.py b/tests/components/conftest.py index c985565b1be..1ebcc864b4b 100644 --- a/tests/components/conftest.py +++ b/tests/components/conftest.py @@ -16,7 +16,7 @@ def patch_zeroconf_multiple_catcher() -> Generator[None, None, None]: yield -@pytest.fixture(autouse=True) +@pytest.fixture(scope="session", autouse=True) def prevent_io() -> Generator[None, None, None]: """Fixture to prevent certain I/O from happening.""" with patch( diff --git a/tests/conftest.py b/tests/conftest.py index 4050c1cdb6a..fcd8e8b73a9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -383,7 +383,7 @@ def reset_hass_threading_local_object() -> Generator[None, None, None]: ha._hass.__dict__.clear() -@pytest.fixture(autouse=True) +@pytest.fixture(scope="session", autouse=True) def bcrypt_cost() -> Generator[None, None, None]: """Run with reduced rounds during tests, to speed up uses.""" import bcrypt @@ -1544,7 +1544,7 @@ async def mock_enable_bluetooth( await hass.async_block_till_done() -@pytest.fixture +@pytest.fixture(scope="session") def mock_bluetooth_adapters() -> Generator[None, None, None]: """Fixture to mock bluetooth adapters.""" with patch( diff --git a/tests/test_bootstrap.py b/tests/test_bootstrap.py index b98d3d0311f..42d679d7ce6 100644 --- a/tests/test_bootstrap.py +++ b/tests/test_bootstrap.py @@ -40,7 +40,7 @@ async def apply_stop_hass(stop_hass: None) -> None: """Make sure all hass are stopped.""" -@pytest.fixture(autouse=True) +@pytest.fixture(scope="session", autouse=True) def mock_http_start_stop() -> Generator[None, None, None]: """Mock HTTP start and stop.""" with patch(