Fix compatibility with Python 3.10

Since testing with Python 3.10, the test
  murano.tests.unit.dsl.test_helpers.TestDSLHelpers.test_weak_ref
was failing with
  testtools.matchers._impl.MismatchError: 'weakref' != 'ReferenceType'

This is simply the result of newer Python being more correct about
the name of the weakref ReferenceType.

The fix here is to ask what the name is of the class and use that
instead of the hardcoded 'weakref' name.

Change-Id: I26ea4750f10dedb04a07d188e57fcd391a28f870
This commit is contained in:
Andy Botting 2022-10-12 21:13:39 +11:00
parent 98cdff796c
commit dc89e7cf61
1 changed files with 1 additions and 1 deletions

View File

@ -265,7 +265,7 @@ class TestDSLHelpers(base.MuranoTestCase):
result = murano_object_weak_ref.__call__()
self.assertEqual(mock.sentinel.res, result)
self.assertEqual('weakref',
self.assertEqual(weakref.ReferenceType.__name__,
murano_object_weak_ref.ref.__class__.__name__)
def test_weak_ref_with_null_obj(self):