fix coordination unit tests

One of the coordination test mocks decorates the test class instead
of the test method.

This is most probably the cause of the failure that occurs on
Python 3.10:

  compute_hyperv.tests.unit.test_coordination.CoordinationTestCase
    .test_synchronized [0.023516s] ... FAILED

  unittest.mock.InvalidSpecError: Cannot autospec a Mock object.
  [object=<_AutospecMagicMock name='get_lock' id='139796387600688'>]

We'll move the decorator to the right place.

Change-Id: If02f7ad022679d74cb88f558b85ee7d22f253c77
This commit is contained in:
Lucian Petrut 2022-09-19 11:30:50 +03:00
parent 02348b98c5
commit f8c8ebc32a
1 changed files with 1 additions and 1 deletions

View File

@ -98,8 +98,8 @@ class CoordinatorTestCase(test_base.HyperVBaseTestCase):
self.assertFalse(agent.started)
@mock.patch.object(coordination.COORDINATOR, 'get_lock')
class CoordinationTestCase(test_base.HyperVBaseTestCase):
@mock.patch.object(coordination.COORDINATOR, 'get_lock')
def test_synchronized(self, get_lock):
@coordination.synchronized('lock-{f_name}-{foo.val}-{bar[val]}')
def func(foo, bar):