Skip to content

Commit

Permalink
Merge pull request #223 from zopefoundation/dataflake/max_open_files
Browse files Browse the repository at this point in the history
Raise the open files limit if needed during test runs
  • Loading branch information
dataflake committed Jan 23, 2023
2 parents 59de2de + dfb287d commit decd904
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ZEO/tests/testZEO.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
##############################################################################
"""Test suite for ZEO based on ZODB.tests."""
import multiprocessing
import resource

from ZEO.ClientStorage import ClientStorage
from ZEO.Exceptions import ClientDisconnected
Expand Down Expand Up @@ -241,6 +242,14 @@ class GenericTestBase(
server_debug = False

def setUp(self):
# Some operating systems like macOS set a very low soft limit for
# the maximum number of open files. Some ZEO tests hit these limits.
(soft_max_open_files,
hard_max_open_files) = resource.getrlimit(resource.RLIMIT_NOFILE)
if soft_max_open_files < 512:
resource.setrlimit(resource.RLIMIT_NOFILE,
(512, hard_max_open_files))

StorageTestBase.StorageTestBase.setUp(self)
logger.info("setUp() %s", self.id())
zport, stop = forker.start_zeo_server(
Expand Down

0 comments on commit decd904

Please sign in to comment.