fix: address whole-branch review findings for update-swarm
- versions: require entire normalized string to be numeric so dates and hotfix suffixes compare as incomparable instead of eq/gt - hosts: exact host or dot-suffix match rejects lookalikes like notmediafire.com and evilmega.nz; GitHub stays exact-set - census: lazy extractor loop so a later OSError no longer discards an earlier sidecar changelog hit - jobs: watchlist parses only table rows whose vault-note cell is a bare wikilink (skips parenthetical related/complete notes); wanted also matches bold names in Wanted.md tables with Pokemon prefix stripped and casefolded - cli: validate-scouts and judge raise SystemExit when jobs.json has jobs but scouts/ has zero valid files - fetch: download forwards timeout=60 to urlopen and writes to a .part file then os.replace, removing the partial on any failure
This commit is contained in:
1 parent
37ebc97b51
commit
cb294f72a0
16 files changed
+234
-48
No files matched your search
@@ -50,5 +50,24 @@ class TestCensus(unittest.TestCase):
|
||||
self.assertEqual(rec2["source"], "unknown")
|
||||
self.assertIsNone(rec2["installed_version"])
|
||||
|
||||
@patch(
|
||||
"update_swarm.census.os.listdir",
|
||||
return_value=["changelog.txt", "dummy.bin"],
|
||||
)
|
||||
def test_rom_version_oserror_keeps_sidecar(self, _listdir):
|
||||
# A later OSError must not discard an earlier sidecar hit.
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
cpath = os.path.join(td, "changelog.txt")
|
||||
with open(cpath, "w", encoding="utf-8") as fh:
|
||||
fh.write("Current Version: 3.3.1\n")
|
||||
rom_path = os.path.join(td, "dummy.bin")
|
||||
with open(rom_path, "wb") as fh:
|
||||
fh.write(b"\x00")
|
||||
with patch("update_swarm.census._rom_version", side_effect=OSError("boom")):
|
||||
rec = census_job(job("S"), rom_path)
|
||||
self.assertEqual(rec["installed_version"], "3.3.1")
|
||||
self.assertEqual(rec["source"], "file")
|
||||
self.assertEqual(rec["evidence"], "sidecar")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user