From 483b0cd017f805c8c0b06f4efeaba7803e172866 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 9 Feb 2023 06:58:32 -0600 Subject: [PATCH] Skip db locking test with postgresql/MySQL (#87760) * Skip db locking test with postgresql/MySQL https://github.com/home-assistant/core/pull/87756#issuecomment-1423828389 * switch to the guards instead --- tests/components/recorder/test_init.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/components/recorder/test_init.py b/tests/components/recorder/test_init.py index 38721a6a436..0358522df25 100644 --- a/tests/components/recorder/test_init.py +++ b/tests/components/recorder/test_init.py @@ -1532,6 +1532,10 @@ async def test_database_lock_and_unlock( tmp_path, ): """Test writing events during lock getting written after unlocking.""" + if recorder_db_url.startswith(("mysql://", "postgresql://")): + # Database locking is only used for SQLite + return + if recorder_db_url == "sqlite://": # Use file DB, in memory DB cannot do write locks. recorder_db_url = "sqlite:///" + str(tmp_path / "pytest.db") @@ -1577,6 +1581,10 @@ async def test_database_lock_and_overflow( tmp_path, ): """Test writing events during lock leading to overflow the queue causes the database to unlock.""" + if recorder_db_url.startswith(("mysql://", "postgresql://")): + # Database locking is only used for SQLite + return + # Use file DB, in memory DB cannot do write locks. if recorder_db_url == "sqlite://": # Use file DB, in memory DB cannot do write locks.