From 1ea778868979ee0ad8a389551d1f67d211745c8e Mon Sep 17 00:00:00 2001 From: "developing-today[bot]" <5454422+developing-today[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 18:39:21 -0600 Subject: [PATCH] test: move unittest.main() guards to end of file in both suites (#5712) Direct-script runs silently skipped every test class defined after the mid-file guard: test_cold_store.py ran 109 of 112 tests and test_update_nixpkgs_inputs.py ran 9 of 14. Moving each guard to end of file makes direct runs execute the full suite; discover counts and outcomes are unchanged. Verified on the laptop: direct runs now report 112 (OK, skipped=1) and 14 tests. The 2 failures in the nixpkgs-inputs suite (TestDiscoverInputs.test_current_flake_lock_keeps_the_four_intended_inputs, root + pkgs/id copies) are pre-existing on clean main and filed as #5725. --- pkgs/cold-store-reaper/tests/test_cold_store.py | 7 ++++--- scripts/tests/test_update_nixpkgs_inputs.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/cold-store-reaper/tests/test_cold_store.py b/pkgs/cold-store-reaper/tests/test_cold_store.py index b4a5ef2549..2ad00b4760 100644 --- a/pkgs/cold-store-reaper/tests/test_cold_store.py +++ b/pkgs/cold-store-reaper/tests/test_cold_store.py @@ -3220,9 +3220,6 @@ def test_sync_loop_non_object_body_raises_cold_store_error(self): self.store.sync_manifest() -if __name__ == "__main__": - unittest.main(verbosity=2) - class TestResumableUploadStalls(ColdStoreTestBase): """#2797: a 308 whose Range stops advancing must not loop forever, @@ -3287,3 +3284,7 @@ def advancing(n, h, d): self.assertEqual(result, "file-x") starts = [int(p.split(" ")[1].split("-")[0]) for p in puts] self.assertEqual(starts, [0, 100, 200, 300, 400, 500, 600, 700, 800, 900]) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/scripts/tests/test_update_nixpkgs_inputs.py b/scripts/tests/test_update_nixpkgs_inputs.py index cd190b259c..5eb65cec77 100644 --- a/scripts/tests/test_update_nixpkgs_inputs.py +++ b/scripts/tests/test_update_nixpkgs_inputs.py @@ -374,9 +374,6 @@ def test_pkgs_id_copy(self): self._check_copy("pkgs/id", COPIES["pkgs/id"]) -if __name__ == "__main__": - unittest.main() - import contextlib import http.server import threading @@ -678,3 +675,7 @@ def test_verification_stays_on_in_both_copies(self): ctx = mod["https_context"]() self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) self.assertTrue(ctx.check_hostname) + + +if __name__ == "__main__": + unittest.main()