From 1da4e933181f0dfe983349c2b1dcda81dba094f8 Mon Sep 17 00:00:00 2001 From: Jing Qiu <61612323+Laughing-q@users.noreply.github.com> Date: Wed, 4 Feb 2026 22:37:08 +0800 Subject: [PATCH] Remove cached `*.npy` files in grayscale tests (#23554) --- tests/test_python.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_python.py b/tests/test_python.py index 6bdadc41..55dd8f07 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -796,6 +796,10 @@ def test_grayscale(task: str, model: str, data: str, tmp_path) -> None: model = YOLO(model) model.train(data=grayscale_data, epochs=1, imgsz=32, close_mosaic=1, cache="disk") + # remove npy files in train/val splits if exists, avoiding interference with other tests + for split in {"train", "val"}: + for npy_file in (Path(data["path"]) / data[split]).glob("*.npy"): + npy_file.unlink() model.val(data=grayscale_data) im = np.zeros((32, 32, 1), dtype=np.uint8) model.predict(source=im, imgsz=32, save_txt=True, save_crop=True, augment=True)