def test_setup_recovers_when_setup_raises(self):
    'Test the setup if exceptions are happening.'
    platform1_setup = Mock(side_effect=Exception('Broken'))
    platform2_setup = Mock(return_value=None)
    mock_entity_platform(self.hass, 'test_domain.mod1', MockPlatform(platform1_setup))
    mock_entity_platform(self.hass, 'test_domain.mod2', MockPlatform(platform2_setup))
    component = EntityComponent(_LOGGER, DOMAIN, self.hass)
    assert (not platform1_setup.called)
    assert (not platform2_setup.called)
    component.setup(OrderedDict([(DOMAIN, {'platform': 'mod1'}), ('{} 2'.format(DOMAIN), {'platform': 'non_exist'}), ('{} 3'.format(DOMAIN), {'platform': 'mod2'})]))
    self.hass.block_till_done()
    assert platform1_setup.called
    assert platform2_setup.called
Test the setup if exceptions are happening.
def test_setup_recovers_when_setup_raises(self):
    
    platform1_setup = Mock(side_effect=Exception('Broken'))
    platform2_setup = Mock(return_value=None)
    mock_entity_platform(self.hass, 'test_domain.mod1', MockPlatform(platform1_setup))
    mock_entity_platform(self.hass, 'test_domain.mod2', MockPlatform(platform2_setup))
    component = EntityComponent(_LOGGER, DOMAIN, self.hass)
    assert (not platform1_setup.called)
    assert (not platform2_setup.called)
    component.setup(OrderedDict([(DOMAIN, {'platform': 'mod1'}), ('{} 2'.format(DOMAIN), {'platform': 'non_exist'}), ('{} 3'.format(DOMAIN), {'platform': 'mod2'})]))
    self.hass.block_till_done()
    assert platform1_setup.called
    assert platform2_setup.called