Skip to content

Commit ad38516

Browse files
codexByron
authored andcommitted
Avoid mapped stream in Windows regression test
The Python package test (windows, 3.7) check still failed during TemporaryDirectory cleanup with WinError 5 because reading the loose object through GitDB.stream() retained its mmap on that interpreter even after explicit stream and Repo cleanup. Use GitDB.info(), whose loose-object implementation closes the mmap in a finally block, to verify the custom object database. Keep git cat-file as the payload check and subprocess-environment regression. Validation: focused regression test; Ruff check and format; git diff --check.
1 parent 5bc6fa2 commit ad38516

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

test/test_repo.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,7 @@ def test_repo_discovery_preserves_object_directory(self):
249249

250250
with repo:
251251
assert osp.samefile(repo.odb.root_path(), object_dir)
252-
object_stream = repo.odb.stream(bytes.fromhex(blob_hexsha))
253-
try:
254-
assert object_stream.read() == payload
255-
finally:
256-
object_stream.stream.close()
252+
assert repo.odb.info(bytes.fromhex(blob_hexsha)).size == len(payload)
257253
assert repo.git.cat_file("blob", blob_hexsha) == payload.decode()
258254

259255
@with_rw_repo("0.3.2.1")

0 commit comments

Comments
 (0)