chore: give the touched tests their right types

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 14:59:49 +01:00
1 parent 7aa93f4ad4
commit 00443c1c57
2 files changed
+12 -8

No files matched your search

+7 -4
View File
@@ -7594,6 +7594,12 @@ class CommentsSayWhy(unittest.TestCase):
self.assertEqual(found, [])
class _ResponseBody(io.BytesIO):
"""A body with the headers attribute urlopen's response carries."""
headers: dict[str, str] = {}
class ExternalDownloadsFollowTheRunPolicy(unittest.TestCase):
"""download_external lived outside packresolve and fetched under
--offline, into the system /tmp, holding the whole body in memory."""
@@ -7601,11 +7607,8 @@ class ExternalDownloadsFollowTheRunPolicy(unittest.TestCase):
ENTRY = {"name": "ext.bin", "source_url": "https://example.invalid/ext.bin",
"sha1": hashlib.sha1(b"payload").hexdigest()}
class _Body(io.BytesIO):
headers: dict = {}
def _response(self, body: bytes):
stream = self._Body(body)
stream = _ResponseBody(body)
response = mock.MagicMock()
response.__enter__.return_value = stream
response.__exit__.return_value = False
+5 -4
View File
@@ -1382,7 +1382,7 @@ class RecalboxExport(unittest.TestCase):
if not original.is_file():
self.skipTest("no cached original for recalbox")
def zips(text: str) -> dict[tuple[str, str], str]:
def zips(text: str) -> dict[tuple[str | None, str | None], str]:
return {
(s.get("platform"), b.get("path")): ",".join(sorted(
v.strip().lower() for v in b.get("md5", "").split(",")
@@ -2518,7 +2518,7 @@ class UpstreamFidelity(unittest.TestCase):
"no upstream cache, run scripts/export_native.py --all --fetch"
)
def _export(self, platform: str, truth: dict | None = None) -> dict[str, str]:
def _export(self, platform: str, truth: dict | None = None) -> tuple[dict, dict[str, str]]:
cache = UPSTREAM_CACHE / platform
if not cache.is_dir():
self.skipTest(f"no cached original for {platform}")
@@ -2627,8 +2627,9 @@ class UpstreamFidelity(unittest.TestCase):
if child.tag == f"{namespace}element":
continue
if child.tag == f"{namespace}attribute":
if child.get("use") == "required" and child.get("name"):
found.add(child.get("name"))
name = child.get("name")
if child.get("use") == "required" and name:
found.add(name)
continue
found |= own_attributes(child)
return found