Fix inconsistent return value of timeutils.utcnow

The function returns a datetime instance without tzinfo.

Change-Id: I0f295482640fc9d615d50ed681ffd6f61bc177ba
This commit is contained in:
Takashi Kajinami
2025-06-03 01:03:11 +09:00
parent c058e79baf
commit 0eccd4a191

View File

@@ -61,7 +61,8 @@ class TestLogNotifier(test_utils.BaseTestCase):
return_value=fake_transport):
self.logger = oslo_messaging.LoggingNotificationHandler('test://')
mock_utcnow.return_value = datetime.datetime.utcnow()
mock_utcnow.return_value = datetime.datetime.utcnow().replace(
tzinfo=None)
levelno = getattr(logging, self.priority.upper(), 42)
@@ -121,7 +122,8 @@ class TestLogNotifier(test_utils.BaseTestCase):
},
})
mock_utcnow.return_value = datetime.datetime.utcnow()
mock_utcnow.return_value = datetime.datetime.utcnow().replace(
tzinfo=None)
levelno = getattr(logging, self.priority.upper())