Skip to content

Commit

Permalink
Increase nofile limit for tests
Browse files Browse the repository at this point in the history
In Python 3.13, we get `OSError: [Errno 24] Too many open files`,
presumably due to an increase in other parts of our code.
  • Loading branch information
erbridge committed Jan 6, 2025
1 parent 5ba7763 commit 156f1ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/tests/server/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ def _write_hook(stream_name, data):
pass

original_limits = resource.getrlimit(resource.RLIMIT_NOFILE)
resource.setrlimit(resource.RLIMIT_NOFILE, (128, original_limits[1]))
resource.setrlimit(resource.RLIMIT_NOFILE, (256, original_limits[1]))
request.addfinalizer(
lambda: resource.setrlimit(resource.RLIMIT_NOFILE, original_limits)
)

r = StreamRedirector(callback=_write_hook, streams=[stream])

for _ in range(10 * 128):
for _ in range(10 * 256):
with r:
stream.write("one\n")
stream.flush()
Expand Down

0 comments on commit 156f1ce

Please sign in to comment.