Drop implicit test dependency on iso8601
The library has been missing from the test requirements although it is directly used. Replace it by the built-in datetime module to get rid of the unmaintained direct dependency. Change-Id: I1d08b38862b54fee4c7c26161f59264fb3f2ce51
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.common import exception
|
||||
@@ -136,7 +136,7 @@ class TestActionObject(base.DbTestCase):
|
||||
action.save()
|
||||
|
||||
expected_update_at = fake_saved_action['updated_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
|
||||
mock_get_action.assert_called_once_with(
|
||||
self.context, uuid, eager=self.eager)
|
||||
@@ -181,7 +181,7 @@ class TestCreateDeleteActionObject(base.DbTestCase):
|
||||
action.create()
|
||||
expected_action = self.fake_action.copy()
|
||||
expected_action['created_at'] = expected_action['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
mock_create_action.assert_called_once_with(expected_action)
|
||||
self.assertEqual(self.context, action._context)
|
||||
|
||||
@@ -201,9 +201,9 @@ class TestCreateDeleteActionObject(base.DbTestCase):
|
||||
|
||||
expected_action = fake_deleted_action.copy()
|
||||
expected_action['created_at'] = expected_action['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
expected_action['deleted_at'] = expected_action['deleted_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
del expected_action['action_plan']
|
||||
|
||||
uuid = self.fake_action['uuid']
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.db.sqlalchemy import api as db_api
|
||||
@@ -60,7 +60,7 @@ class TestActionDescriptionObject(base.DbTestCase):
|
||||
action_desc.create()
|
||||
expected_action_desc = self.fake_action_desc.copy()
|
||||
expected_action_desc['created_at'] = expected_action_desc[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
|
||||
mock_create_action_desc.assert_called_once_with(expected_action_desc)
|
||||
self.assertEqual(self.context, action_desc._context)
|
||||
@@ -107,9 +107,9 @@ class TestActionDescriptionObject(base.DbTestCase):
|
||||
|
||||
expected_action_desc = fake_deleted_action_desc.copy()
|
||||
expected_action_desc['created_at'] = expected_action_desc[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
expected_action_desc['deleted_at'] = expected_action_desc[
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
'deleted_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
|
||||
_id = self.fake_action_desc['id']
|
||||
action_desc = objects.ActionDescription.get(self.context, _id)
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.common import exception
|
||||
@@ -139,10 +139,10 @@ class TestActionPlanObject(base.DbTestCase):
|
||||
expected_action_plan = fake_saved_action_plan.copy()
|
||||
expected_action_plan[
|
||||
'created_at'] = expected_action_plan['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
expected_action_plan[
|
||||
'updated_at'] = expected_action_plan['updated_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
|
||||
uuid = self.fake_action_plan['uuid']
|
||||
action_plan = objects.ActionPlan.get_by_uuid(
|
||||
@@ -207,7 +207,7 @@ class TestCreateDeleteActionPlanObject(base.DbTestCase):
|
||||
action_plan.create()
|
||||
expected_action_plan = self.fake_action_plan.copy()
|
||||
expected_action_plan['created_at'] = expected_action_plan[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
mock_create_action_plan.assert_called_once_with(expected_action_plan)
|
||||
self.assertEqual(self.context, action_plan._context)
|
||||
|
||||
@@ -239,9 +239,9 @@ class TestCreateDeleteActionPlanObject(base.DbTestCase):
|
||||
m_soft_delete_action_plan.return_value = fake_deleted_action_plan
|
||||
expected_action_plan = fake_deleted_action_plan.copy()
|
||||
expected_action_plan['created_at'] = expected_action_plan[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
expected_action_plan['deleted_at'] = expected_action_plan[
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
'deleted_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
del expected_action_plan['audit']
|
||||
del expected_action_plan['strategy']
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.common import exception
|
||||
@@ -130,9 +130,9 @@ class TestAuditObject(base.DbTestCase):
|
||||
|
||||
expected_audit = fake_saved_audit.copy()
|
||||
expected_audit['created_at'] = expected_audit['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
expected_audit['updated_at'] = expected_audit['updated_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
|
||||
uuid = self.fake_audit['uuid']
|
||||
audit = objects.Audit.get_by_uuid(self.context, uuid, eager=self.eager)
|
||||
@@ -193,7 +193,7 @@ class TestCreateDeleteAuditObject(base.DbTestCase):
|
||||
audit.create()
|
||||
expected_audit = self.fake_audit.copy()
|
||||
expected_audit['created_at'] = expected_audit['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
mock_create_audit.assert_called_once_with(expected_audit)
|
||||
self.assertEqual(self.context, audit._context)
|
||||
|
||||
@@ -210,9 +210,9 @@ class TestCreateDeleteAuditObject(base.DbTestCase):
|
||||
|
||||
expected_audit = fake_deleted_audit.copy()
|
||||
expected_audit['created_at'] = expected_audit['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
expected_audit['deleted_at'] = expected_audit['deleted_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
del expected_audit['goal']
|
||||
del expected_audit['strategy']
|
||||
|
||||
@@ -308,7 +308,7 @@ class TestAuditObjectSendNotifications(base.DbTestCase):
|
||||
fake_deleted_audit['deleted_at'] = timeutils.utcnow()
|
||||
expected_audit = fake_deleted_audit.copy()
|
||||
expected_audit['deleted_at'] = expected_audit['deleted_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
|
||||
m_soft_delete_audit.return_value = fake_deleted_audit
|
||||
m_update_audit.return_value = fake_deleted_audit
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.common import exception
|
||||
@@ -177,7 +177,7 @@ class TestCreateDeleteAuditTemplateObject(base.DbTestCase):
|
||||
audit_template.create()
|
||||
expected_audit_template = self.fake_audit_template.copy()
|
||||
expected_audit_template['created_at'] = expected_audit_template[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
mock_create_audit_template.assert_called_once_with(
|
||||
expected_audit_template)
|
||||
self.assertEqual(self.context, audit_template._context)
|
||||
@@ -193,9 +193,9 @@ class TestCreateDeleteAuditTemplateObject(base.DbTestCase):
|
||||
|
||||
expected_audit_template = fake_deleted_audit_template.copy()
|
||||
expected_audit_template['created_at'] = expected_audit_template[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
expected_audit_template['deleted_at'] = expected_audit_template[
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
'deleted_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
del expected_audit_template['goal']
|
||||
del expected_audit_template['strategy']
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.db.sqlalchemy import api as db_api
|
||||
@@ -71,7 +71,7 @@ class TestGoalObject(base.DbTestCase):
|
||||
goal.create()
|
||||
expected_goal = self.fake_goal.copy()
|
||||
expected_goal['created_at'] = expected_goal['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
mock_create_goal.assert_called_once_with(expected_goal)
|
||||
self.assertEqual(self.context, goal._context)
|
||||
|
||||
@@ -130,9 +130,9 @@ class TestGoalObject(base.DbTestCase):
|
||||
|
||||
expected_goal = fake_deleted_goal.copy()
|
||||
expected_goal['created_at'] = expected_goal['created_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
expected_goal['deleted_at'] = expected_goal['deleted_at'].replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
|
||||
uuid = self.fake_goal['uuid']
|
||||
goal = objects.Goal.get_by_uuid(self.context, uuid)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
import contextlib
|
||||
import datetime
|
||||
import gettext
|
||||
import iso8601
|
||||
from unittest import mock
|
||||
|
||||
from oslo_versionedobjects import base as object_base
|
||||
@@ -268,7 +267,7 @@ class _TestObject(object):
|
||||
self.assertEqual('updated', obj.bar)
|
||||
|
||||
def test_base_attributes(self):
|
||||
dt = datetime.datetime(1955, 11, 5, 0, 0, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(1955, 11, 5, 0, 0, tzinfo=datetime.timezone.utc)
|
||||
datatime = fields.DateTimeField()
|
||||
obj = MyObj(self.context)
|
||||
obj.created_at = dt
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.db.sqlalchemy import api as db_api
|
||||
@@ -78,7 +78,7 @@ class TestScoringEngineObject(base.DbTestCase):
|
||||
scoring_engine.create()
|
||||
expected_scoring_engine = self.fake_scoring_engine.copy()
|
||||
expected_scoring_engine['created_at'] = expected_scoring_engine[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
mock_create_scoring_engine.assert_called_once_with(
|
||||
expected_scoring_engine)
|
||||
self.assertEqual(self.context, scoring_engine._context)
|
||||
@@ -139,9 +139,9 @@ class TestScoringEngineObject(base.DbTestCase):
|
||||
|
||||
expected_scoring_engine = fake_deleted_scoring_engine.copy()
|
||||
expected_scoring_engine['created_at'] = expected_scoring_engine[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
expected_scoring_engine['deleted_at'] = expected_scoring_engine[
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
'deleted_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
|
||||
_id = self.fake_scoring_engine['id']
|
||||
scoring_engine = objects.ScoringEngine.get_by_id(self.context, _id)
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from watcher.db.sqlalchemy import api as db_api
|
||||
@@ -56,7 +56,7 @@ class TestServiceObject(base.DbTestCase):
|
||||
service.create()
|
||||
expected_service = self.fake_service.copy()
|
||||
expected_service['created_at'] = expected_service[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
|
||||
mock_create_service.assert_called_once_with(expected_service)
|
||||
self.assertEqual(self.context, service._context)
|
||||
@@ -103,9 +103,9 @@ class TestServiceObject(base.DbTestCase):
|
||||
|
||||
expected_service = fake_deleted_service.copy()
|
||||
expected_service['created_at'] = expected_service[
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
'created_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
expected_service['deleted_at'] = expected_service[
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
'deleted_at'].replace(tzinfo=datetime.timezone.utc)
|
||||
|
||||
_id = self.fake_service['id']
|
||||
service = objects.Service.get(self.context, _id)
|
||||
|
||||
Reference in New Issue
Block a user