From 0b7c64269fff25e02ac1091819b892f4f987e56c Mon Sep 17 00:00:00 2001 From: jeffreykennethli Date: Mon, 13 Dec 2021 09:40:26 -0800 Subject: [PATCH] FIX-#3818: Ignore files from /private/tmp/ray/ when detecting file leaks (#3826) Signed-off-by: jeffreykennethli --- modin/pandas/test/utils.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modin/pandas/test/utils.py b/modin/pandas/test/utils.py index 68dbd8b2a33..a13a60faa8b 100644 --- a/modin/pandas/test/utils.py +++ b/modin/pandas/test/utils.py @@ -11,6 +11,7 @@ # ANY KIND, either express or implied. See the License for the specific language # governing permissions and limitations under the License. +import re import pytest import numpy as np import math @@ -1101,10 +1102,17 @@ def check(*a, **kw): try: fstart.remove(item) except ValueError: - # ignore files in /proc/, as they have nothing to do with - # modin reading any data (and this is what we care about) - if not item[0].startswith("/proc/"): - leaks.append(item) + # Ignore files in /proc/, as they have nothing to do with + # modin reading any data (and this is what we care about). + if item[0].startswith("/proc/"): + continue + # Ignore files in /tmp/ray/session_*/logs (ray session logs) + # because Ray intends to keep these logs open even after + # work has been done. + if re.search(r"/tmp/ray/session_.*/logs", item[0]): + continue + leaks.append(item) + assert ( not leaks ), f"Unexpected open handles left for: {', '.join(item[0] for item in leaks)}"