Custom Integration Tests for Config Flow

I’ve decided to implement proper tests for the config flow for my custom integration and I am slightly confused by the example scaffold code.

Does anyone know why the first test in the example calls:

await hass.async_block_till_done()

after the call to flow.async_configure while none of the other tests do.

As an aside, one thing that I found that may be useful for others is that one now needs to define this fixture in conftest.py for the tests to work…

import pytest

@pytest.fixture(autouse=True)
def auto_enable_custom_integrations(enable_custom_integrations):
    yield

Thanks to the author of the sample test in pytest-homeassistant-custom-component for helping me to work this out.

1 Like