Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions google/cloud/pubsub_v1/subscriber/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import datetime as dt
import json
import math
import pytz
import time

from google.cloud.pubsub_v1.subscriber._protocol import requests
Expand Down Expand Up @@ -110,7 +109,7 @@ def __init__(self, message, ack_id, delivery_attempt, request_queue):
self._data = message.data
self._publish_time = dt.datetime.fromtimestamp(
message.publish_time.seconds + message.publish_time.nanos / 1e9,
tz=pytz.UTC,
tz=dt.timezone.utc,
)
self._ordering_key = message.ordering_key
self._size = message.ByteSize()
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/pubsub_v1/subscriber/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import time

import mock
import pytz

from google.api_core import datetime_helpers
from google.cloud.pubsub_v1.subscriber import message
Expand All @@ -26,7 +25,7 @@
from google.pubsub_v1 import types as gapic_types


RECEIVED = datetime.datetime(2012, 4, 21, 15, 0, tzinfo=pytz.utc)
RECEIVED = datetime.datetime(2012, 4, 21, 15, 0, tzinfo=datetime.timezone.utc)
RECEIVED_SECONDS = datetime_helpers.to_milliseconds(RECEIVED) // 1000
PUBLISHED_MICROS = 123456
PUBLISHED = RECEIVED + datetime.timedelta(days=1, microseconds=PUBLISHED_MICROS)
Expand Down