diff --git a/sync2jira/downstream_issue.py b/sync2jira/downstream_issue.py index 7e1a8d7..57214e7 100644 --- a/sync2jira/downstream_issue.py +++ b/sync2jira/downstream_issue.py @@ -17,18 +17,17 @@ # # Authors: Ralph Bean -# Build-In Modules -import operator +# Python Standard Library Modules +from datetime import datetime, timezone +import difflib import logging +import operator import re -import difflib # 3rd Party Modules import arrow -import jira.client from jira import JIRAError -from datetime import datetime -from zoneinfo import ZoneInfo +import jira.client import jinja2 import pypandoc @@ -38,8 +37,7 @@ # The date the service was upgraded # This is used to ensure legacy comments are not touched -UTC = ZoneInfo(key='UTC') -UPDATE_DATE = datetime(2019, 7, 9, 18, 18, 36, 480291, UTC) +UPDATE_DATE = datetime(2019, 7, 9, 18, 18, 36, 480291, tzinfo=timezone.utc) log = logging.getLogger('sync2jira') diff --git a/tests/test_downstream_issue.py b/tests/test_downstream_issue.py index c09129f..4770c86 100644 --- a/tests/test_downstream_issue.py +++ b/tests/test_downstream_issue.py @@ -1,8 +1,7 @@ import unittest import unittest.mock as mock from unittest.mock import MagicMock -from datetime import datetime -from zoneinfo import ZoneInfo +from datetime import datetime, timezone import sync2jira.downstream_issue as d from sync2jira.intermediary import Issue @@ -12,8 +11,6 @@ PATH = 'sync2jira.downstream_issue.' -UTC = ZoneInfo(key='UTC') - class TestDownstreamIssue(unittest.TestCase): """ @@ -1494,7 +1491,7 @@ def test_find_comment_in_jira_legacy(self, mock_jira_comment.raw = {'body': 'mock_legacy_comment_body'} mock_comment = { 'id': '12345', - 'date_created': datetime(2019, 8, 8, 0, 0, 0, 0, UTC) + 'date_created': datetime(2019, 8, 8, tzinfo=timezone.utc) } # Call the function @@ -1520,7 +1517,7 @@ def test_find_comment_in_jira_id(self, mock_jira_comment.raw = {'body': '12345'} mock_comment = { 'id': '12345', - 'date_created': datetime(2019, 8, 8, 0, 0, 0, 0, UTC) + 'date_created': datetime(2019, 8, 8, tzinfo=timezone.utc) } # Call the function @@ -1546,7 +1543,7 @@ def test_find_comment_in_jira_old_comment(self, mock_jira_comment.raw = {'body': 'old_comment'} mock_comment = { 'id': '12345', - 'date_created': datetime(2019, 1, 1, 0, 0, 0, 0, UTC) + 'date_created': datetime(2019, 1, 1, tzinfo=timezone.utc) } # Call the function @@ -1570,7 +1567,7 @@ def test_find_comment_in_jira_none(self, mock_comment_format_legacy.return_value = 'mock_legacy_comment_body' mock_comment = { 'id': '12345', - 'date_created': datetime(2019, 1, 1, 0, 0, 0, 0, UTC) + 'date_created': datetime(2019, 1, 1, tzinfo=timezone.utc) } # Call the function