From e3317b75789696cd473a0295b173df62f52a18a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 02:27:02 +0000 Subject: [PATCH] Fix tests/test_live.py nested object file test: it passed only by directory order _pointed took the first entry of objects/ with iterdir(), which is filesystem order. The nested-file test made objects/well first, so locally the pick was the directory, the replace in the manifest was a no-op and the test read write_fov's own file. On the CI runner the file came first, the manifest was really pointed at the nested file, and that file had no 'x' column. Pick only files, give the nested file the feature column, and assert its three objects were read. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a --- tests/test_live.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test_live.py b/tests/test_live.py index 2b278b8a..0c559960 100644 --- a/tests/test_live.py +++ b/tests/test_live.py @@ -388,7 +388,11 @@ def _pointed(folder, target: str): """One field written by write_fov, its manifest line pointed at ``target`` instead.""" write_fov(folder, *_field("A01", 0)) manifest = folder / MANIFEST - relative = next((folder / "objects").iterdir()).relative_to(folder).as_posix() + # Only files: iterdir order is filesystem-dependent, and a test may have made a + # sub-folder of objects/ first (which, picked here, made the replace a silent no-op). + written = [path for path in (folder / "objects").iterdir() if path.is_file()] + assert len(written) == 1 + relative = written[0].relative_to(folder).as_posix() manifest.write_text(manifest.read_text().replace(relative, target)) return _folder_session(folder) @@ -428,11 +432,11 @@ def test_a_missing_object_file_outside_the_folder_is_named_when_opted_in(tmp_pat def test_a_nested_relative_object_file_inside_the_folder_is_read(tmp_path): folder = tmp_path / "live" (folder / "objects" / "well").mkdir(parents=True) - pd.DataFrame({"label_id": [1], "area": [1.0]}).to_csv( - folder / "objects/well/f.csv", index=False - ) + nested = folder / "objects/well/f.csv" + pd.DataFrame({"x": [1.0, 2.0, 3.0]}).to_csv(nested, index=False) live = _pointed(folder, "objects/well/f.csv") - assert len(live.poll()) == 1 + (update,) = live.poll() + assert update.n_objects == 3 # the nested file was read, not the file write_fov wrote (5) @pytest.mark.parametrize(