Skip to content

Commit 35c6078

Browse files
committed
Merge test_sensor.test_query_from_yaml
Signed-off-by: David Rapan <[email protected]>
1 parent a173293 commit 35c6078

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

tests/components/sql/test_sensor.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -301,23 +301,17 @@ def rollback(self) -> None:
301301
assert "sqlite://****:****@homeassistant.local" in caplog.text
302302

303303

304-
async def test_query_from_yaml(recorder_mock: Recorder, hass: HomeAssistant) -> None:
305-
"""Test the SQL sensor from yaml config."""
306-
307-
assert await async_setup_component(hass, DOMAIN, YAML_CONFIG)
308-
await hass.async_block_till_done()
309-
310-
state = hass.states.get("sensor.get_value")
311-
assert state.state == "5"
312-
313-
314-
async def test_async_query_from_yaml(
315-
recorder_mock: Recorder, hass: HomeAssistant
304+
@pytest.mark.parametrize("async_driver", [False, True])
305+
async def test_query_from_yaml(
306+
recorder_mock: Recorder, hass: HomeAssistant, async_driver: bool
316307
) -> None:
317308
"""Test the SQL sensor from yaml config using async driver."""
318309

319-
config = copy.deepcopy(YAML_CONFIG)
320-
config["sql"][CONF_DB_URL] = "sqlite+aiosqlite://"
310+
config = YAML_CONFIG
311+
312+
if async_driver:
313+
config = copy.deepcopy(YAML_CONFIG)
314+
config["sql"][CONF_DB_URL] = "sqlite+aiosqlite://"
321315

322316
assert await async_setup_component(hass, DOMAIN, config)
323317
await hass.async_block_till_done()

0 commit comments

Comments
 (0)