mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
Fix ci-bonsai-daily: configure unmerged_blobs mock in git_mergetool tests (#8574)
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 <noreply@anthropic.com>
This commit is contained in:
@@ -497,6 +497,8 @@ class TestGitMergetool:
|
|||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
ifc_path = os.path.join(tmpdir, "model.ifc")
|
ifc_path = os.path.join(tmpdir, "model.ifc")
|
||||||
mock_repo = mock.MagicMock()
|
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
|
IfcGitRepo.repo = mock_repo
|
||||||
result = IfcGit.git_mergetool("ifcmerge", ifc_path)
|
result = IfcGit.git_mergetool("ifcmerge", ifc_path)
|
||||||
assert result is None
|
assert result is None
|
||||||
@@ -511,6 +513,8 @@ class TestGitMergetool:
|
|||||||
report_path = ifc_path + ".ifcmerge"
|
report_path = ifc_path + ".ifcmerge"
|
||||||
open(report_path, "w").close()
|
open(report_path, "w").close()
|
||||||
mock_repo = mock.MagicMock()
|
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
|
IfcGitRepo.repo = mock_repo
|
||||||
result = IfcGit.git_mergetool("ifcmerge", ifc_path)
|
result = IfcGit.git_mergetool("ifcmerge", ifc_path)
|
||||||
assert result is None
|
assert result is None
|
||||||
|
|||||||
Reference in New Issue
Block a user