Use MagicMock for Connection object

After https://review.opendev.org/#/c/745746/ there are new calls to
'with self.lock' which fail in unit tests that only use a Mock object
for the Connection that is passed to an API impl object. Switching to
MagicMock fixes it.

Closes-Bug: #1893965

Change-Id: Icbcb5e004dfa777877d1865a5018262344c7e415
This commit is contained in:
Terry Wilson 2020-09-02 10:37:33 -05:00
parent 5e942ff21a
commit 6fc24afd9a
1 changed files with 1 additions and 1 deletions

View File

@ -361,7 +361,7 @@ class TestNBImplIdlOvn(TestDBImplIdlOvn):
with mock.patch.object(ovs_idl.Backend, 'autocreate_indices',
create=True):
impl_idl_ovn.OvsdbNbOvnIdl.ovsdb_connection = None
self.nb_ovn_idl = impl_idl_ovn.OvsdbNbOvnIdl(mock.Mock())
self.nb_ovn_idl = impl_idl_ovn.OvsdbNbOvnIdl(mock.MagicMock())
self.nb_ovn_idl.idl.tables = self._tables