We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 853bc28 commit bd2a931Copy full SHA for bd2a931
debianbts/debianbts.py
@@ -19,7 +19,7 @@
19
import urllib.request
20
import xml.etree.ElementTree as ET
21
from collections.abc import Iterable, Mapping
22
-from datetime import UTC, datetime
+from datetime import datetime, timezone
23
from typing import Any
24
25
logger = logging.getLogger(__name__)
@@ -419,9 +419,9 @@ def _parse_status(bug_el: dict[str, Any]) -> Bugreport:
419
):
420
setattr(bug, field, bug_el[field])
421
422
- bug.date = datetime.fromtimestamp(float(bug_el["date"]), UTC)
+ bug.date = datetime.fromtimestamp(float(bug_el["date"]), timezone.utc)
423
bug.log_modified = datetime.fromtimestamp(
424
- float(bug_el["log_modified"]), UTC
+ float(bug_el["log_modified"]), timezone.utc
425
)
426
bug.tags = str(bug_el["tags"]).split()
427
bug.done = _parse_bool(bug_el["done"])
tests/test_debianbts.py
@@ -174,7 +174,10 @@ def test_sample_get_status() -> None:
174
assert len(bugs) == 1
175
bug = bugs[0]
176
assert bug.bug_num == 486212
177
- assert bug.date == datetime.datetime(2008, 6, 14, 10, 30, 2)
+ assert bug.date == datetime.datetime(
178
+ 2008, 6, 14, 10, 30, 2,
179
+ tzinfo=datetime.timezone.utc
180
+ )
181
assert bug.subject.startswith("[reportbug-ng] segm")
182
assert bug.package == "reportbug-ng"
183
assert bug.severity == "normal"
@@ -184,7 +187,10 @@ def test_sample_get_status() -> None:
184
187
assert bug.summary == ""
185
188
assert bug.location == "archive"
186
189
assert bug.source == "reportbug-ng"
- assert bug.log_modified == datetime.datetime(2008, 8, 17, 7, 26, 22)
190
+ assert bug.log_modified == datetime.datetime(
191
+ 2008, 8, 17, 7, 26, 22,
192
193
194
assert bug.pending == "done"
195
assert bug.done
196
assert bug.done_by == "Bastian Venthur <venthur@debian.org>"
0 commit comments