diff options
author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2014-09-15 21:23:58 -0400 |
---|---|---|
committer | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2014-09-16 16:38:49 -0400 |
commit | 45553a6dda84ef6be38150071f8bb6fa9850a53e (patch) | |
tree | 13e0c02791f0fa7a7e11db16cfc8b2bac4a9a214 /nova/tests/virt/hyperv | |
parent | 51fff2459356a484b190d5610e4f2c953fdb59ac (diff) | |
download | nova-45553a6dda84ef6be38150071f8bb6fa9850a53e.tar.gz |
mock.assert_called_once() is not a valid method
mock.assert_called_once() is a no-op that tests nothing. Instead
with mock.assert_called_once_with() should be used (or use
assertEqual(1, mock_obj.call_count) if you don't want to check
parameters).
Add a new HACKING rule for nova to prevent assert_called_once()
usage from creeping in.
Closes-Bug: #1365751
Change-Id: I1055093a1c31792b6411a3cd46c80b8bcaaf78c1
Diffstat (limited to 'nova/tests/virt/hyperv')
-rw-r--r-- | nova/tests/virt/hyperv/test_ioutils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nova/tests/virt/hyperv/test_ioutils.py b/nova/tests/virt/hyperv/test_ioutils.py index 786d6363e4..570d6a6722 100644 --- a/nova/tests/virt/hyperv/test_ioutils.py +++ b/nova/tests/virt/hyperv/test_ioutils.py @@ -50,7 +50,7 @@ class IOThreadTestCase(test.NoDBTestCase): self._iothread._copy(self._FAKE_SRC, self._FAKE_DEST) fake_dest.write.assert_called_once_with(fake_data) - fake_dest.close.assert_called_once() + fake_dest.close.assert_called_once_with() fake_rename.assert_called_once_with( self._iothread._dest, self._iothread._dest_archive) fake_remove.assert_called_once_with( |