[openstack-dev] Decorator behavior

John S Warren jswarren at us.ibm.com
Mon Mar 31 17:27:09 UTC 2014


At run time there are decorators that behave in an unexpected manner.
For instance, in nova/compute/manager.py when ComputeManager's
resize_instance method is called, the "migration" positional argument
is somehow added to kwargs (paired with the "migration" key) and is
stripped out of the args parameters when the decorators are called.
However, when this same method is called in
nova/tests/compute/test_compute_mgr.py, the "migration" positional
argument remains in args when the decorators are called.  In other
words at run time the decorators see these arguments:

(self, context, [], {'migration': migration, 'image': image,
'instance': instance, 'reservations': reservations})

while when running a test case, they see these arguments:

(self, context, [instance, image, reservations, migration,
instance_type], {})


What is happening at run time to cause this behavior?  How can this
behavior be duplicated when executing test cases, so that the test
cases correctly mimic run-time behavior?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140331/91a19f96/attachment.html>


More information about the OpenStack-dev mailing list