Skip to content

Commit

Permalink
Merge pull request #77 from pycompression/memoryerror
Browse files Browse the repository at this point in the history
Avoid MemoryError during tests on 32-bit architectures
  • Loading branch information
marcelm authored Oct 2, 2021
2 parents f652d21 + 3c54e5f commit 3a0a481
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test_xopen.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,11 @@ def test_xopen_falls_back_to_bzip2_open(lacking_pbzip2_permissions):

def test_open_many_writers(tmp_path, ext):
files = []
for i in range(1, 61):
path = tmp_path / f"{i:03d}.txt.{ext}"
# Because lzma.open allocates a lot of memory,
# open fewer files to avoid MemoryError on 32-bit architectures
n = 21 if ext == ".xz" else 61
for i in range(1, n):
path = tmp_path / f"{i:03d}.txt{ext}"
f = xopen(path, "wb", threads=2)
f.write(b"hello")
files.append(f)
Expand Down

0 comments on commit 3a0a481

Please sign in to comment.