async def test_setup_entry_fails_duplicate(hass):
    "Test we don't allow setting up a config entry twice."
    mock_setup_entry = Mock(return_value=mock_coro(True))
    mock_entity_platform(hass, 'test_domain.entry_domain', MockPlatform(async_setup_entry=mock_setup_entry))
    component = EntityComponent(_LOGGER, DOMAIN, hass)
    entry = MockConfigEntry(domain='entry_domain')
    assert (await component.async_setup_entry(entry))
    with pytest.raises(ValueError):
        (await component.async_setup_entry(entry))
Test we don't allow setting up a config entry twice.
async def test_setup_entry_fails_duplicate(hass):
    
    mock_setup_entry = Mock(return_value=mock_coro(True))
    mock_entity_platform(hass, 'test_domain.entry_domain', MockPlatform(async_setup_entry=mock_setup_entry))
    component = EntityComponent(_LOGGER, DOMAIN, hass)
    entry = MockConfigEntry(domain='entry_domain')
    assert (await component.async_setup_entry(entry))
    with pytest.raises(ValueError):
        (await component.async_setup_entry(entry))