Skip to content

Commit d48679a

Browse files
committed
tc: HALF FIX of test_pack_entity ()
+ On Windows, you cannot write onto a file held by another live file-pointer (test_pack.py:#L204). + The TC fails later, on clean up (the usual).
1 parent 587dc4e commit d48679a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: gitdb/test/test_pack.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,18 @@ def test_pack_entity(self, rw_dir):
188188

189189
# pack writing - write all packs into one
190190
# index path can be None
191-
pack_path = tempfile.mktemp('', "pack", rw_dir)
191+
pack_path1 = tempfile.mktemp('', "pack1", rw_dir)
192+
pack_path2 = tempfile.mktemp('', "pack2", rw_dir)
192193
index_path = tempfile.mktemp('', 'index', rw_dir)
193194
iteration = 0
194195

195196
def rewind_streams():
196197
for obj in pack_objs:
197198
obj.stream.seek(0)
198199
# END utility
199-
for ppath, ipath, num_obj in zip((pack_path, ) * 2, (index_path, None), (len(pack_objs), None)):
200+
for ppath, ipath, num_obj in zip((pack_path1, pack_path2),
201+
(index_path, None),
202+
(len(pack_objs), None)):
200203
iwrite = None
201204
if ipath:
202205
ifile = open(ipath, 'wb')
@@ -214,7 +217,7 @@ def rewind_streams():
214217
assert os.path.getsize(ppath) > 100
215218

216219
# verify pack
217-
pf = PackFile(ppath)
220+
pf = PackFile(ppath) # FIXME: Leaks file-pointer(s)!
218221
assert pf.size() == len(pack_objs)
219222
assert pf.version() == PackFile.pack_version_default
220223
assert pf.checksum() == pack_sha

0 commit comments

Comments
 (0)