

def test_from_retry(self):
    retry_dict = {
        'num_attempts': 1,
        'hosts': [['fake1', 'node1']],
    }
    ctxt = context.RequestContext('fake', 'fake')
    spec = objects.RequestSpec(ctxt)
    spec._from_retry(retry_dict)
    self.assertIsInstance(spec.retry, objects.SchedulerRetries)
    self.assertEqual(1, spec.retry.num_attempts)
    self.assertIsInstance(spec.retry.hosts, objects.ComputeNodeList)
    self.assertEqual(1, len(spec.retry.hosts))
    self.assertEqual('fake1', spec.retry.hosts[0].host)
    self.assertEqual('node1', spec.retry.hosts[0].hypervisor_hostname)

dataset/ETHPy150Open openstack/nova/nova/tests/unit/objects/test_request_spec.py _TestRequestSpecObject.test_from_retry/original