From e5a081c7dd774f188afebfca09c00eb6e2b4f4c9 Mon Sep 17 00:00:00 2001 From: Phil Bruckner Date: Sat, 11 Jul 2020 13:34:53 -0500 Subject: [PATCH] Fix script queued mode typo (#37759) --- homeassistant/helpers/script.py | 8 ++++---- tests/helpers/test_script.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index af12d68249f..268028eec3d 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -52,12 +52,12 @@ from homeassistant.util.dt import utcnow # mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs SCRIPT_MODE_PARALLEL = "parallel" -SCRIPT_MODE_QUEUE = "queue" +SCRIPT_MODE_QUEUED = "queued" SCRIPT_MODE_RESTART = "restart" SCRIPT_MODE_SINGLE = "single" SCRIPT_MODE_CHOICES = [ SCRIPT_MODE_PARALLEL, - SCRIPT_MODE_QUEUE, + SCRIPT_MODE_QUEUED, SCRIPT_MODE_RESTART, SCRIPT_MODE_SINGLE, ] @@ -580,7 +580,7 @@ class Script: self._runs: List[_ScriptRun] = [] self._max_runs = max_runs - if script_mode == SCRIPT_MODE_QUEUE: + if script_mode == SCRIPT_MODE_QUEUED: self._queue_lck = asyncio.Lock() self._config_cache: Dict[Set[Tuple], Callable[..., bool]] = {} self._referenced_entities: Optional[Set[str]] = None @@ -677,7 +677,7 @@ class Script: self._log("Maximum number of runs exceeded", level=logging.WARNING) return - if self._script_mode != SCRIPT_MODE_QUEUE: + if self._script_mode != SCRIPT_MODE_QUEUED: cls = _ScriptRun else: cls = _QueuedScriptRun diff --git a/tests/helpers/test_script.py b/tests/helpers/test_script.py index 48a6c90e10c..4ba407dd046 100644 --- a/tests/helpers/test_script.py +++ b/tests/helpers/test_script.py @@ -1112,8 +1112,8 @@ async def test_script_mode_2(hass, caplog, script_mode, messages, last_events): assert events[idx].data["value"] == value -async def test_script_mode_queue(hass): - """Test overlapping runs with script_mode = 'queue' & max_runs > 1.""" +async def test_script_mode_queued(hass): + """Test overlapping runs with script_mode = 'queued' & max_runs > 1.""" event = "test_event" events = async_capture_events(hass, event) sequence = cv.SCRIPT_SCHEMA( @@ -1126,7 +1126,7 @@ async def test_script_mode_queue(hass): ) logger = logging.getLogger("TEST") script_obj = script.Script( - hass, sequence, script_mode="queue", max_runs=2, logger=logger + hass, sequence, script_mode="queued", max_runs=2, logger=logger ) wait_started_flag = async_watch_for_action(script_obj, "wait")