← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1584762] [NEW] Assignment with mock.Mock broke other tests

 

Public bug reported:

Assignment with mock.Mock broke other tests

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.


References:
[1] https://github.com/openstack/nova/blob/master/nova/tests/unit/virt/libvirt/test_driver.py#L14676

** Affects: nova
     Importance: Undecided
     Assignee: javeme (javaloveme)
         Status: In Progress

-- 
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):
  In Progress

Bug description:
  Assignment with mock.Mock broke other tests

  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.

  
  References:
  [1] 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


Follow ups