No such thing as mock.assert_called_once()
Bug #1336766 reported by
Pavlo Shchelokovskyy
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Fix Released
|
Undecided
|
Pavlo Shchelokovskyy |
Bug Description
Some unit tests use the following assertion on mock objects returned by mock.Mock / mock.MagicMock classes:
mocked.
This is wrong, as the mock object has only methods assert_
The correct usage (if one cares only about call count and not arguments) is
self.assertEqual(1, mocked.call_count)
Changed in heat: | |
assignee: | nobody → Pavlo Shchelokovskyy (pshchelo) |
description: | updated |
Changed in heat: | |
milestone: | none → juno-2 |
status: | Fix Committed → Fix Released |
Changed in heat: | |
milestone: | juno-2 → 2014.2 |
To post a comment you must log in.
after fixing I get this unit test failing: test_engine_ service. ThreadGroupMana gerTest. test_tgm_ start_with_ lock
heat.tests.
So indeed at this place the assertion relied upon was not triggered. Investigating further.