Fix blocking process call in process tests (#121104)
Discovered by ruff in https://github.com/home-assistant/core/pull/120799pull/120799/head
parent
291f309c0e
commit
7958c0825e
|
@ -1,20 +1,25 @@
|
|||
"""Test process util."""
|
||||
|
||||
from functools import partial
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util import process
|
||||
|
||||
|
||||
async def test_kill_process() -> None:
|
||||
async def test_kill_process(hass: HomeAssistant) -> None:
|
||||
"""Test killing a process."""
|
||||
sleeper = subprocess.Popen( # noqa: S602 # shell by design
|
||||
"sleep 1000",
|
||||
shell=True,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
sleeper = await hass.async_add_executor_job(
|
||||
partial( # noqa: S604 # shell by design
|
||||
subprocess.Popen,
|
||||
"sleep 1000",
|
||||
shell=True,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
)
|
||||
pid = sleeper.pid
|
||||
|
||||
|
|
Loading…
Reference in New Issue