@mock.patch("%s.flavors.osclients.Clients" % CTX)
    def test_setup_failexists(self, mock_clients):
        # Setup and mock
        new_context = copy.deepcopy(self.context)
        new_context["flavors"] = {}

        mock_flavor_create = mock_clients().nova().flavors.create

        exception = nova_exceptions.Conflict("conflict")
        mock_flavor_create.side_effect = exception

        # Run
        flavors_ctx = flavors.FlavorsGenerator(self.context)
        flavors_ctx.setup()

        # Assertions
        self.assertEqual(new_context, flavors_ctx.context)

        mock_clients.assert_called_with(self.context["admin"]["credential"])

        mock_flavor_create.assert_called_once_with(
            name="flavor_name", ram=2048, vcpus=3,
            disk=10, ephemeral=3, swap=5)
dataset/ETHPy150Open openstack/rally/tests/unit/plugins/openstack/context/nova/test_flavors.py/FlavorsGeneratorTestCase.test_setup_failexists/original