Skip to content

Commit 6fa5367

Browse files
committed
TST: Avoid utc import from django timezone
1 parent e4a0916 commit 6fa5367

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tests/test_storage.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66
# Disabled because gcloud api dynamically constructed
77
# pylint: disable=no-member
88

9+
from datetime import datetime, timedelta
910
import gzip
1011
import mimetypes
11-
from datetime import datetime, timedelta
1212
from unittest import mock
13+
1314
from django.core.exceptions import ImproperlyConfigured
1415
from django.core.files.base import ContentFile
1516
from django.test import TestCase, override_settings
1617
from django.utils import timezone
17-
from django_gcp.storage import gcloud
1818
from google.cloud.exceptions import NotFound
1919
from google.cloud.storage.blob import Blob
20+
from zoneinfo import ZoneInfo
21+
22+
from django_gcp.storage import gcloud
23+
24+
UTC = ZoneInfo("UTC")
2025

2126

2227
class NonSeekableContentFile(ContentFile):
@@ -258,7 +263,8 @@ def test_size_no_file(self):
258263

259264
def test_modified_time(self):
260265
naive_date = datetime(2017, 1, 2, 3, 4, 5, 678)
261-
aware_date = timezone.make_aware(naive_date, timezone.utc)
266+
267+
aware_date = timezone.make_aware(naive_date, UTC)
262268

263269
self.storage._bucket = mock.MagicMock()
264270
blob = mock.MagicMock()
@@ -273,7 +279,7 @@ def test_modified_time(self):
273279

274280
def test_get_modified_time(self):
275281
naive_date = datetime(2017, 1, 2, 3, 4, 5, 678)
276-
aware_date = timezone.make_aware(naive_date, timezone.utc)
282+
aware_date = timezone.make_aware(naive_date, UTC)
277283

278284
self.storage._bucket = mock.MagicMock()
279285
blob = mock.MagicMock()
@@ -295,7 +301,7 @@ def test_get_modified_time(self):
295301

296302
def test_get_created_time(self):
297303
naive_date = datetime(2017, 1, 2, 3, 4, 5, 678)
298-
aware_date = timezone.make_aware(naive_date, timezone.utc)
304+
aware_date = timezone.make_aware(naive_date, UTC)
299305

300306
self.storage._bucket = mock.MagicMock()
301307
blob = mock.MagicMock()

0 commit comments

Comments
 (0)