From 627c24ec50816cfe2d05511121fc6943a00c3d89 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Mon, 13 Jul 2026 06:37:39 +0300 Subject: [PATCH] Fix ci-bonsai-daily: configure unmerged_blobs mock in git_mergetool tests test_returns_none_when_report_file_absent/empty build a MagicMock repo without configuring index.unmerged_blobs(), so it returned a truthy MagicMock and git_mergetool's load-bearing "unresolved conflicts remain" fallback (tool/ifcgit.py:646-647) returned that list instead of None - failing "assert [] is None". The production fallback is correct and intentionally left untouched; the tests just misrepresented the "mergetool resolved cleanly" scenario they are named for. Set mock_repo.index.unmerged_blobs.return_value = {} in both. Verified in headless Blender: test/tool/test_ifcgit.py::TestGitMergetool 2 failed / 1 passed -> 3 passed. This change was made with the assistance of an AI tool. Co-Authored-By: Claude Fable 5 --- src/bonsai/test/tool/test_ifcgit.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bonsai/test/tool/test_ifcgit.py b/src/bonsai/test/tool/test_ifcgit.py index 964bd96fd2..b987e1235b 100644 --- a/src/bonsai/test/tool/test_ifcgit.py +++ b/src/bonsai/test/tool/test_ifcgit.py @@ -497,6 +497,8 @@ class TestGitMergetool: with tempfile.TemporaryDirectory() as tmpdir: ifc_path = os.path.join(tmpdir, "model.ifc") mock_repo = mock.MagicMock() + # A clean mergetool resolution leaves no unmerged blobs in the index. + mock_repo.index.unmerged_blobs.return_value = {} IfcGitRepo.repo = mock_repo result = IfcGit.git_mergetool("ifcmerge", ifc_path) assert result is None @@ -511,6 +513,8 @@ class TestGitMergetool: report_path = ifc_path + ".ifcmerge" open(report_path, "w").close() mock_repo = mock.MagicMock() + # A clean mergetool resolution leaves no unmerged blobs in the index. + mock_repo.index.unmerged_blobs.return_value = {} IfcGitRepo.repo = mock_repo result = IfcGit.git_mergetool("ifcmerge", ifc_path) assert result is None