gh-152190: Fix memory checking failure in `test_zipfile64.py` (GH-152203)
* gh-152190: Fix memory checking failure in `test_strip_removed_large_file_with_dd_no_sig` Remove the overly restrictive `allowed_memory` override (200 KiB) in `test_strip_removed_large_file_with_dd_no_sig` to prevent a memory checking failure. * gh-152190: Revise comment about the empirical memory threshold * gh-152190: Improve memory checking accuracy for `test_zipfile64` Introduce the `assert_memory_usage` context manager to narrow the scope of tracemalloc tracking down exclusively to the file-repacking phase. This prevents previous file-writing side effects from interfering with the baseline, improves tracing accuracy, and eliminates redundant inner sub-function wrappers. * gh-152190: Improve coding style and docstrings * gh-152190: Remove unneeded comments and checks Remove redundant "TESTFN2" disk space warnings from TestRepack, as these tests exclusively use TemporaryFile(). Additionally, remove the repetitive `self.assertFalse(f.closed)` checks from `TestRepack` methods since it's already verified in `TestsWithSourceFile`. * gh-152190: Further optimize tests and tidy code Rename `TestRepack` to `TestRepacker` to better reflect its coverage of `zipfile._Repacker`. Move heavy text chunk generation and common constants from `setUp` to `setUpClass` to ensure single initialization across tests. Clean up repetitive local definitions of filenames and lorem text by promoting them to class properties. Reduce the test file size from 8 GiB to 4.1 GiB, which is large enough to trigger ZIP64 extension and sufficient for the testing purpose. --------- Co-authored-by: Zachary Ware <zach@python.org>
D
Danny Lin committed
e5ed2ad9be8e0014a3bf4dc9f89c4ad2695500cd
Parent: ee1da7e
Committed by GitHub <noreply@github.com>
on 8/24/2026, 4:54:55 PM