mock.assert_not_called() is not a thing

Bug #1316167 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Matt Riedemann

Bug Description

We have 14 hits of tests using mock.assert_not_called() which is not a real method for mocks:

nova
nova
tests
api
openstack
test_common.py
395: href_link_mock.assert_not_called()
compute
test_compute_utils.py (2 matches)
764: mock_log.warning.assert_not_called()
775: mock_log.warning.assert_not_called()
image
test_glance.py (10 matches)
548: img.assert_not_called()
556: img.assert_not_called()
690: trans_from_mock.assert_not_called()
708: is_avail_mock.assert_not_called()
709: trans_from_mock.assert_not_called()
754: trans_from_mock.assert_not_called()
791: is_avail_mock.assert_not_called()
792: trans_from_mock.assert_not_called()
848: trans_from_mock.assert_not_called()
920: trans_from_mock.assert_not_called()
virt
baremetal
test_nova_baremetal_deploy_helper.py
339: self.m_mp.assert_not_called()

https://code.google.com/p/mock/issues/detail?id=159

We should be using self.assertFalse(mock.called) instead.

Tags: testing
Matt Riedemann (mriedem)
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/92181

Changed in nova:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/92181
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=92d92c7fe1d4db4a5c263d4499eae64568765047
Submitter: Jenkins
Branch: master

commit 92d92c7fe1d4db4a5c263d4499eae64568765047
Author: Matt Riedemann <email address hidden>
Date: Sun May 4 19:05:44 2014 -0700

    Fix calls to mock.assert_not_called()

    There is no assert_not_called() method in mock, as described here:

    https://code.google.com/p/mock/issues/detail?id=159

    Fix these calls to use the mock.called attribute instead.

    Closes-Bug: #1316167

    Change-Id: I865463244ebfc45e1f940c74e1afbb9084930bb3

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.