yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #52123
[Bug 1584762] Re: Assignment with mock.Mock broke other tests
Reviewed: https://review.openstack.org/319916
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=be62910946bb109fdf3e2101eaacdf19f9f1b2e4
Submitter: Jenkins
Branch: master
commit be62910946bb109fdf3e2101eaacdf19f9f1b2e4
Author: Javeme <zhangmei.li@xxxxxxxxxxxx>
Date: Mon May 23 20:49:42 2016 +0800
Nova UTs broken due to modifying loopingcall global var
In unit tests, this practice that we just replace a method/class with
the Mock directly would break other tests, like the following:
loopingcall.FixedIntervalLoopingCall = mock.Mock()
We should use mock.patch() instead of the assignment with mock.Mock.
Change-Id: Id6f0ee53fc7ecf452fa8c015e26e4d59e716a10d
Closes-Bug: #1584762
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1584762
Title:
Assignment with mock.Mock broke other tests
Status in OpenStack Compute (nova):
Fix Released
Bug description:
In unit tests, this practice that we just replace a method/class with the Mock directly would break other tests [1], like the following:
loopingcall.FixedIntervalLoopingCall = mock.Mock() [2]
We should use mock.patch() instead.
References:
[1] http://logs.openstack.org/34/181634/28/check/gate-nova-python27-db/6ccd0b2/testr_results.html.gz
[2] https://github.com/openstack/nova/blob/master/nova/tests/unit/virt/libvirt/test_driver.py#L14676
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1584762/+subscriptions
References