Improve ergonomics of FlowManager.async_show_progress (#107668)

* Improve ergonomics of FlowManager.async_show_progress

* Don't include progress coroutine in web response

* Unconditionally reset progress task when show_progress finished

* Fix race

* Tweak, add tests

* Address review comments

* Improve error handling

* Allow progress jobs to return anything

* Add comment

* Remove unneeded check

* Change API according to discussion

* Adjust typing
This commit is contained in:
Erik Montnemery 2024-01-11 12:00:12 +01:00 committed by GitHub
parent 00b40c964a
commit 24cd6a8a52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 221 additions and 28 deletions

View file

@ -121,10 +121,11 @@ async def test_flow_with_activation_failure(
)
assert result["step_id"] == "device"
assert result["type"] == FlowResultType.SHOW_PROGRESS
await hass.async_block_till_done()
result = await hass.config_entries.flow.async_configure(result["flow_id"])
assert result["type"] == FlowResultType.SHOW_PROGRESS_DONE
assert result["step_id"] == "could_not_register"
assert result["type"] == FlowResultType.ABORT
assert result["reason"] == "could_not_register"
async def test_flow_with_remove_while_activating(