From e04d20a8bc3cfea11c9699219919d0a0158d74fb Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 9 Nov 2023 23:58:39 +0900 Subject: [PATCH] Fix unit tests broken by olso.utils Some of the object unit tests grub Mock object unintentionally, and that results in failure during initializing an versioned object, because the Mock object does not present its version correctly. This fixes that problem The sqlalchemy-2x job is made non-voting because this job requires oslo.utils 6.3.0 which is blocked by this problem. Closes-Bug: #2043116 Related-Bug: #2042886 Change-Id: Id1c1b77c020e2d8f0ac61c2aee86c9f37d388d53 --- .zuul.yaml | 2 ++ nova/tests/unit/objects/test_objects.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.zuul.yaml b/.zuul.yaml index df5770ec62..05ba8defdc 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -36,6 +36,8 @@ Takes advantage of the base tox job's install-siblings feature. # The job only tests the latest and shouldn't be run on the stable branches branches: ^master$ + # TODO(tkajinam): Make this voting once oslo.utils is bumped to 6.3.0 + voting: false required-projects: - name: github.com/sqlalchemy/sqlalchemy override-checkout: main diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py index 6ae1de1b24..5ccb32e613 100644 --- a/nova/tests/unit/objects/test_objects.py +++ b/nova/tests/unit/objects/test_objects.py @@ -1040,6 +1040,7 @@ class TestArgsSerializer(test.NoDBTestCase): class TestRegistry(test.NoDBTestCase): @mock.patch('nova.objects.base.objects') def test_hook_chooses_newer_properly(self, mock_objects): + del mock_objects.MyObj reg = base.NovaObjectRegistry() reg.registration_hook(MyObj, 0) @@ -1056,6 +1057,7 @@ class TestRegistry(test.NoDBTestCase): @mock.patch('nova.objects.base.objects') def test_hook_keeps_newer_properly(self, mock_objects): + del mock_objects.MyObj reg = base.NovaObjectRegistry() reg.registration_hook(MyObj, 0)