From e827420569cfdc25eaa5b0ab9c48353ed5ce4888 Mon Sep 17 00:00:00 2001 From: bendikro Date: Wed, 13 Apr 2016 03:06:25 +0200 Subject: [PATCH] [Tests] Increase file descriptor limit Increase the file descriptor limit to avoid 'Too many files open' error when running tests. --- deluge/tests/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/deluge/tests/__init__.py b/deluge/tests/__init__.py index e69de29bb..388b399e8 100644 --- a/deluge/tests/__init__.py +++ b/deluge/tests/__init__.py @@ -0,0 +1,13 @@ +# Increase open file descriptor limit to allow tests to run +# without getting error: what(): epoll: Too many open files +from __future__ import print_function + +try: + import resource +except ImportError: # Does not exist on Windows + pass +else: + try: + resource.setrlimit(resource.RLIMIT_NOFILE, (65536, 65536)) + except (ValueError, resource.error) as ex: + print("Failed to raise file descriptor limit:", ex)