| 605 | @requires_memory(free_bytes=7e9) |
| 606 | def test_large_zip(self): |
| 607 | def check_large_zip(memoryerror_raised): |
| 608 | memoryerror_raised.value = False |
| 609 | try: |
| 610 | # The test takes at least 6GB of memory, writes a file larger |
| 611 | # than 4GB. This tests the ``allowZip64`` kwarg to ``zipfile`` |
| 612 | test_data = np.asarray([np.random.rand( |
| 613 | np.random.randint(50,100),4) |
| 614 | for i in range(800000)], dtype=object) |
| 615 | with tempdir() as tmpdir: |
| 616 | np.savez(os.path.join(tmpdir, 'test.npz'), |
| 617 | test_data=test_data) |
| 618 | except MemoryError: |
| 619 | memoryerror_raised.value = True |
| 620 | raise |
| 621 | # run in a subprocess to ensure memory is released on PyPy, see gh-15775 |
| 622 | # Use an object in shared memory to re-raise the MemoryError exception |
| 623 | # in our process if needed, see gh-16889 |