diff --git a/tests/topotests/conftest.py b/tests/topotests/conftest.py index 44536e945efe..dafd19c283aa 100755 --- a/tests/topotests/conftest.py +++ b/tests/topotests/conftest.py @@ -522,9 +522,14 @@ def pytest_configure(config): is_xdist = True is_worker = True - resource.setrlimit( - resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY) - ) + try: + resource.setrlimit( + resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY) + ) + except ValueError: + # The hard limit cannot be raised. Raise the soft limit to previous hard limit + core_rlimits = resource.getrlimit(resource.RLIMIT_CORE) + resource.setrlimit(resource.RLIMIT_CORE, (core_rlimits[1], core_rlimits[1])) # ----------------------------------------------------- # Set some defaults for the pytest.ini [pytest] section # ---------------------------------------------------