Closed
Description
See warning below which appears in the Kokoro build log
tests/unit/handlers/transports/test_background_thread.py: 11 warnings
/tmpfs/src/github/python-logging/google/cloud/logging_v2/handlers/transports/background_thread.py:243: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
"timestamp": datetime.datetime.utcfromtimestamp(record.created),
Remove usage here:
Also remove usage of datetime.datetime.utcnow()
which also appears in the build log
tests/unit/test__http.py::Test_LoggingAPI::test_list_entries_with_limits
/tmpfs/src/github/python-logging/tests/unit/test__http.py:127: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
NOW = datetime.datetime.utcnow().replace(tzinfo=UTC)
tests/unit/test_entries.py::TestLogEntry::test_from_api_repr_w_folder_path
/tmpfs/src/github/python-logging/tests/unit/test_entries.py:348: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
NOW = datetime.utcnow().replace(tzinfo=UTC)
tests/unit/test_entries.py::TestLogEntry::test_from_api_repr_w_loggers_no_logger_match
/tmpfs/src/github/python-logging/tests/unit/test_entries.py:210: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
NOW = datetime.utcnow().replace(tzinfo=UTC)
tests/unit/test_entries.py::TestLogEntry::test_from_api_repr_w_loggers_w_logger_match
/tmpfs/src/github/python-logging/tests/unit/test_entries.py:290: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
NOW = datetime.utcnow().replace(tzinfo=UTC)
Remove usage here:
python-logging/tests/unit/test__http.py
Line 127 in d3dc2ac