Skip to content

Commit 8602098

Browse files
cliffhallclaude
andcommitted
test(git): compare git_show blob output with the file's raw bytes
The blob tests assumed LF line endings, but write_text() writes CRLF on Windows and git_show returns the blob's bytes as stored. The protocol test now compares with the fixture file's raw bytes, and the unit test writes explicit LF bytes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 9a81d42 commit 8602098

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/git/tests/test_protocol.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,9 @@ async def test_git_show_revision_path_shows_the_file(repo: git.Repo):
830830
"git_show",
831831
{"repo_path": str(root_of(repo)), "revision": "HEAD:test.txt"},
832832
)
833-
assert result == text_result("line 1\nline 2\nline 3\nline 4\nline 5\n")
833+
# Compared with the raw bytes: the fixture writes text, so CRLF on Windows.
834+
expected = (root_of(repo) / "test.txt").read_bytes().decode()
835+
assert result == text_result(expected)
834836

835837

836838
async def test_git_show_revision_path_to_a_directory_lists_it(repo: git.Repo):

‎src/git/tests/test_server.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def test_git_show_initial_commit(test_repository):
297297
def test_git_show_blob_object_spec(test_repository):
298298
file_path = Path(test_repository.working_dir) / "logic" / "infos.py"
299299
file_path.parent.mkdir()
300-
file_path.write_text("print('infos')\n")
300+
file_path.write_bytes(b"print('infos')\n")
301301
test_repository.index.add(["logic/infos.py"])
302302
test_repository.index.commit("add infos")
303303

0 commit comments

Comments
 (0)