Skip to content
Open

WIP #100

Show file tree
Hide file tree
Changes from all 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 .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -17,10 +16,10 @@ jobs:
- macos-latest
- windows-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 8 additions & 6 deletions debianbts/debianbts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import urllib.request
import xml.etree.ElementTree as ET
from collections.abc import Iterable, Mapping
from datetime import datetime
from datetime import datetime, timezone
from typing import Any

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -227,7 +227,7 @@ def get_status(

"""
numbers: list[int]
if not isinstance(nrs, (list, tuple)):
if not isinstance(nrs, list | tuple):
numbers = [nrs]
else:
numbers = list(nrs)
Expand Down Expand Up @@ -303,7 +303,7 @@ def get_bug_log(
attachments: list[Any] = []

mail_parser = email.feedparser.BytesFeedParser(
policy=email.policy.SMTP
policy=email.policy.SMTP # type: ignore
)
mail_parser.feed(header.encode())
mail_parser.feed(b"\n\n")
Expand Down Expand Up @@ -419,8 +419,10 @@ def _parse_status(bug_el: dict[str, Any]) -> Bugreport:
):
setattr(bug, field, bug_el[field])

bug.date = datetime.utcfromtimestamp(float(bug_el["date"]))
bug.log_modified = datetime.utcfromtimestamp(float(bug_el["log_modified"]))
bug.date = datetime.fromtimestamp(float(bug_el["date"]), timezone.utc)
bug.log_modified = datetime.fromtimestamp(
float(bug_el["log_modified"]), timezone.utc
)
bug.tags = str(bug_el["tags"]).split()
bug.done = _parse_bool(bug_el["done"])
bug.done_by = bug_el["done"] if bug.done else None
Expand Down Expand Up @@ -646,7 +648,7 @@ def _encode_value(parent: ET.Element, name: str, value: Any) -> None:
el.set(f"{{{XSI}}}type", ET.QName(SOAPENC, "Array")) # type: ignore
el.set(
f"{{{SOAPENC}}}arrayType",
ET.QName(XSD, "anyType[%d]" % len(value)), # type: ignore
ET.QName(XSD, f"anyType[{len(value)}]"), # type: ignore
)
for x in value:
_encode_value(el, "item", x)
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ authors = [
]
description = "Python interface to Debian's Bug Tracking System"
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.9, <4"
license-files = ["LICENSE"]
requires-python = ">=3.10, <4"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Bug Tracking",
]
Expand Down Expand Up @@ -61,7 +60,6 @@ addopts = """

[tool.ruff]
line-length = 79
target-version = "py39"

[tool.ruff.lint]
select = [
Expand Down
22 changes: 11 additions & 11 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
build==1.2.1
mkdocs==1.6.0
mkdocs-material==9.5.31
mkdocstrings[python]==0.25.2
pytest==8.3.2
pytest-cov==5.0.0
pytest-xdist==3.6.1
ruff==0.6.0
wheel==0.44.0
twine==5.1.1
mypy==1.11.1
build==1.2.2.post1
mkdocs==1.6.1
mkdocs-material==9.6.14
mkdocstrings[python]==0.29.1
pytest==8.4.0
pytest-cov==6.1.1
pytest-xdist==3.7.0
ruff==0.11.12
wheel==0.45.1
twine==6.1.0
mypy==1.16.0
13 changes: 10 additions & 3 deletions tests/test_debianbts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import logging
import math
import unittest.mock as mock
from typing import Any, Callable
from collections.abc import Callable
from typing import Any

import pytest
from pytest import LogCaptureFixture
Expand Down Expand Up @@ -173,7 +174,10 @@ def test_sample_get_status() -> None:
assert len(bugs) == 1
bug = bugs[0]
assert bug.bug_num == 486212
assert bug.date == datetime.datetime(2008, 6, 14, 10, 30, 2)
assert bug.date == datetime.datetime(
2008, 6, 14, 10, 30, 2,
tzinfo=datetime.timezone.utc
)
assert bug.subject.startswith("[reportbug-ng] segm")
assert bug.package == "reportbug-ng"
assert bug.severity == "normal"
Expand All @@ -183,7 +187,10 @@ def test_sample_get_status() -> None:
assert bug.summary == ""
assert bug.location == "archive"
assert bug.source == "reportbug-ng"
assert bug.log_modified == datetime.datetime(2008, 8, 17, 7, 26, 22)
assert bug.log_modified == datetime.datetime(
2008, 8, 17, 7, 26, 22,
tzinfo=datetime.timezone.utc
)
assert bug.pending == "done"
assert bug.done
assert bug.done_by == "Bastian Venthur <venthur@debian.org>"
Expand Down