Skip to content

Commit bd2a931

Browse files
committed
fixed utc issue in test
1 parent 853bc28 commit bd2a931

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

debianbts/debianbts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import urllib.request
2020
import xml.etree.ElementTree as ET
2121
from collections.abc import Iterable, Mapping
22-
from datetime import UTC, datetime
22+
from datetime import datetime, timezone
2323
from typing import Any
2424

2525
logger = logging.getLogger(__name__)
@@ -419,9 +419,9 @@ def _parse_status(bug_el: dict[str, Any]) -> Bugreport:
419419
):
420420
setattr(bug, field, bug_el[field])
421421

422-
bug.date = datetime.fromtimestamp(float(bug_el["date"]), UTC)
422+
bug.date = datetime.fromtimestamp(float(bug_el["date"]), timezone.utc)
423423
bug.log_modified = datetime.fromtimestamp(
424-
float(bug_el["log_modified"]), UTC
424+
float(bug_el["log_modified"]), timezone.utc
425425
)
426426
bug.tags = str(bug_el["tags"]).split()
427427
bug.done = _parse_bool(bug_el["done"])

tests/test_debianbts.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ def test_sample_get_status() -> None:
174174
assert len(bugs) == 1
175175
bug = bugs[0]
176176
assert bug.bug_num == 486212
177-
assert bug.date == datetime.datetime(2008, 6, 14, 10, 30, 2)
177+
assert bug.date == datetime.datetime(
178+
2008, 6, 14, 10, 30, 2,
179+
tzinfo=datetime.timezone.utc
180+
)
178181
assert bug.subject.startswith("[reportbug-ng] segm")
179182
assert bug.package == "reportbug-ng"
180183
assert bug.severity == "normal"
@@ -184,7 +187,10 @@ def test_sample_get_status() -> None:
184187
assert bug.summary == ""
185188
assert bug.location == "archive"
186189
assert bug.source == "reportbug-ng"
187-
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+
tzinfo=datetime.timezone.utc
193+
)
188194
assert bug.pending == "done"
189195
assert bug.done
190196
assert bug.done_by == "Bastian Venthur <venthur@debian.org>"

0 commit comments

Comments
 (0)