From a8ccf1c6fc4c141d42d5fa85553e4e2710461f45 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 4 Jun 2025 08:09:19 +0200 Subject: [PATCH] Update pytest to 8.4.0 (#146114) --- pyproject.toml | 1 + requirements_test.txt | 2 +- tests/components/backup/test_manager.py | 4 ++-- tests/components/workday/test_config_flow.py | 15 ++++++++++----- tests/test_test_fixtures.py | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6291ef5193a..f0d0a71c9b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -492,6 +492,7 @@ asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" filterwarnings = [ "error::sqlalchemy.exc.SAWarning", + "error:usefixtures\\(\\) in .* without arguments has no effect:UserWarning", # pytest # -- HomeAssistant - aiohttp # Overwrite web.Application to pass a custom default argument to _make_request diff --git a/requirements_test.txt b/requirements_test.txt index c0494d93705..dca3b8f9675 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -30,7 +30,7 @@ pytest-timeout==2.4.0 pytest-unordered==0.6.1 pytest-picked==0.5.1 pytest-xdist==3.7.0 -pytest==8.3.5 +pytest==8.4.0 requests-mock==1.12.1 respx==0.22.0 syrupy==4.9.1 diff --git a/tests/components/backup/test_manager.py b/tests/components/backup/test_manager.py index 59c1bf24b21..f641ce75867 100644 --- a/tests/components/backup/test_manager.py +++ b/tests/components/backup/test_manager.py @@ -1866,7 +1866,7 @@ async def test_exception_platform_pre(hass: HomeAssistant) -> None: BackupManagerExceptionGroup, ( "Multiple errors when creating backup: Error during pre-backup: Boom, " - "Error during post-backup: Test exception (2 sub-exceptions)" + "Error during post-backup: Test exception" ), ), ( @@ -1874,7 +1874,7 @@ async def test_exception_platform_pre(hass: HomeAssistant) -> None: BackupManagerExceptionGroup, ( "Multiple errors when creating backup: Error during pre-backup: Boom, " - "Error during post-backup: Test exception (2 sub-exceptions)" + "Error during post-backup: Test exception" ), ), ], diff --git a/tests/components/workday/test_config_flow.py b/tests/components/workday/test_config_flow.py index c05da654f96..2c0e9aa1123 100644 --- a/tests/components/workday/test_config_flow.py +++ b/tests/components/workday/test_config_flow.py @@ -28,9 +28,8 @@ from homeassistant.util.dt import UTC from . import init_integration -pytestmark = pytest.mark.usefixtures("mock_setup_entry") - +@pytest.mark.usefixtures("mock_setup_entry") async def test_form(hass: HomeAssistant) -> None: """Test we get the forms.""" @@ -74,6 +73,7 @@ async def test_form(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_province_no_alias(hass: HomeAssistant) -> None: """Test we get the forms.""" @@ -115,6 +115,7 @@ async def test_form_province_no_alias(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_no_country(hass: HomeAssistant) -> None: """Test we get the forms correctly without a country.""" @@ -154,6 +155,7 @@ async def test_form_no_country(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_no_subdivision(hass: HomeAssistant) -> None: """Test we get the forms correctly without subdivision.""" @@ -196,6 +198,7 @@ async def test_form_no_subdivision(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form(hass: HomeAssistant) -> None: """Test we get the form in options.""" @@ -242,6 +245,7 @@ async def test_options_form(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_incorrect_dates(hass: HomeAssistant) -> None: """Test errors in setup entry.""" @@ -314,6 +318,7 @@ async def test_form_incorrect_dates(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form_incorrect_dates(hass: HomeAssistant) -> None: """Test errors in options.""" @@ -390,6 +395,7 @@ async def test_options_form_incorrect_dates(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form_abort_duplicate(hass: HomeAssistant) -> None: """Test errors in options for duplicates.""" @@ -443,6 +449,7 @@ async def test_options_form_abort_duplicate(hass: HomeAssistant) -> None: assert result2["errors"] == {"base": "already_configured"} +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_incorrect_date_range(hass: HomeAssistant) -> None: """Test errors in setup entry.""" @@ -515,6 +522,7 @@ async def test_form_incorrect_date_range(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form_incorrect_date_ranges(hass: HomeAssistant) -> None: """Test errors in options.""" @@ -591,9 +599,6 @@ async def test_options_form_incorrect_date_ranges(hass: HomeAssistant) -> None: } -pytestmark = pytest.mark.usefixtures() - - @pytest.mark.parametrize( ("language", "holiday"), [ diff --git a/tests/test_test_fixtures.py b/tests/test_test_fixtures.py index 0bada601a3b..e220b1f4574 100644 --- a/tests/test_test_fixtures.py +++ b/tests/test_test_fixtures.py @@ -5,6 +5,7 @@ from http import HTTPStatus import pathlib import socket +from _pytest.compat import get_real_func from aiohttp import web import pytest import pytest_socket @@ -100,7 +101,7 @@ async def test_evict_faked_translations(hass: HomeAssistant, translations_once) # The evict_faked_translations fixture has module scope, so we set it up and # tear it down manually - real_func = evict_faked_translations.__pytest_wrapped__.obj + real_func = get_real_func(evict_faked_translations) gen: Generator = real_func(translations_once) # Set up the evict_faked_translations fixture