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
This commit is contained in:
J. Nick Koston 2023-02-09 06:58:32 -06:00 committed by GitHub
parent f5b651750c
commit 483b0cd017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1532,6 +1532,10 @@ async def test_database_lock_and_unlock(
tmp_path, tmp_path,
): ):
"""Test writing events during lock getting written after unlocking.""" """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://": if recorder_db_url == "sqlite://":
# Use file DB, in memory DB cannot do write locks. # Use file DB, in memory DB cannot do write locks.
recorder_db_url = "sqlite:///" + str(tmp_path / "pytest.db") recorder_db_url = "sqlite:///" + str(tmp_path / "pytest.db")
@ -1577,6 +1581,10 @@ async def test_database_lock_and_overflow(
tmp_path, tmp_path,
): ):
"""Test writing events during lock leading to overflow the queue causes the database to unlock.""" """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. # Use file DB, in memory DB cannot do write locks.
if recorder_db_url == "sqlite://": if recorder_db_url == "sqlite://":
# Use file DB, in memory DB cannot do write locks. # Use file DB, in memory DB cannot do write locks.