Fix script queued mode typo (#37759)

This commit is contained in:
Phil Bruckner 2020-07-11 13:34:53 -05:00 committed by GitHub
parent 690579749e
commit e5a081c7dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -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

View file

@ -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")