fix: let a refresh failure reach the exit code

This commit is contained in:
Abdessamad Derraz committed 2026-09-07 05:30:56 +02:00
1 parent 17b7633314
commit 1c976390d7
7 files changed
+70 -21

No files matched your search

+4 -2
View File
@@ -252,8 +252,6 @@ class PathTailBeatsABareName(unittest.TestCase):
self.assertEqual(status, "name_exact")
if __name__ == "__main__":
unittest.main()
class ArchivePrefixCopies(unittest.TestCase):
@@ -303,3 +301,7 @@ class ArchivePrefixCopies(unittest.TestCase):
{"neogeo.zip": ["abc"]},
)
self.assertEqual(extras, [])
if __name__ == "__main__":
unittest.main()
+34 -2
View File
@@ -1275,8 +1275,36 @@ class PipelineReportsWhatItDid(unittest.TestCase):
stale = re.findall(r'results\["(\w+)"\] = True', source)
self.assertEqual(stale, [], f"steps still claiming OK when skipped: {stale}")
if __name__ == "__main__":
unittest.main()
class TestEntryPointsRunEveryClass(unittest.TestCase):
"""`unittest.main()` has to sit after the last test class.
In this file it sat in the middle, so running it directly discovered only
the classes defined above it: eight cases never ran that way, while
`python -m unittest discover` ran all of them. The two roads have to agree.
"""
def test_no_module_calls_main_before_its_last_class(self):
for path in sorted((ROOT / "tests").glob("test_*.py")):
lines = path.read_text(encoding="utf-8").splitlines()
# Column zero only: the same text appears inside this very test as
# a string literal, and a substring search matched that instead.
entry = next(
(n for n, line in enumerate(lines)
if line.startswith("if __name__ ==")),
None,
)
if entry is None:
continue
last_class = max(
(n for n, line in enumerate(lines) if line.startswith("class ")),
default=-1,
)
self.assertGreater(
entry,
last_class,
f"{path.name} calls unittest.main() before its last class, so "
"running the file directly skips what follows",
)
class ScriptsImportThreeWays(unittest.TestCase):
@@ -1399,3 +1427,7 @@ class ModuleConstantsDeclaredOnce(unittest.TestCase):
if again:
offenders[path.name] = again
self.assertEqual(offenders, {})
if __name__ == "__main__":
unittest.main()
+3 -3
View File
@@ -485,9 +485,6 @@ class TestDiff(unittest.TestCase):
self.assertEqual(diff["unchanged"], 1)
if __name__ == "__main__":
unittest.main()
class TestSourceRefDrift(unittest.TestCase):
"""A set whose ROMs are unchanged but whose driver line moved is an update."""
@@ -586,3 +583,6 @@ class TestDerivativeVersion(unittest.TestCase):
entry = self._run(add_new)["files"][0]
self.assertEqual(entry["source_ref"], "src/mame/philips/cdi.cpp:484")
if __name__ == "__main__":
unittest.main()
+4 -4
View File
@@ -257,10 +257,6 @@ class GapAnalysisAgreesWithTheBuilder(unittest.TestCase):
)
if __name__ == "__main__":
unittest.main()
class CandidateVerdict(unittest.TestCase):
"""Whether a profile entry can be a gap, and whether it is settled.
@@ -479,3 +475,7 @@ class OneProfileSelector(unittest.TestCase):
'is a launcher -use the emulator it launches', text,
f"{name} still spells the refusal itself",
)
if __name__ == "__main__":
unittest.main()