25
25
from gitdb .fun import delta_types
26
26
from gitdb .exc import UnsupportedOperation
27
27
from gitdb .util import to_bin_sha
28
- from itertools import izip
28
+ from itertools import izip , chain
29
+ from nose import SkipTest
30
+
29
31
import os
32
+ import sys
33
+ import tempfile
30
34
31
35
32
36
#{ Utilities
@@ -134,7 +138,9 @@ def test_pack(self):
134
138
self ._assert_pack_file (pack , version , size )
135
139
# END for each pack to test
136
140
137
- def test_pack_entity (self ):
141
+ @with_rw_directory
142
+ def test_pack_entity (self , rw_dir ):
143
+ pack_iterators = list ();
138
144
for packinfo , indexinfo in ( (self .packfile_v2_1 , self .packindexfile_v1 ),
139
145
(self .packfile_v2_2 , self .packindexfile_v2 ),
140
146
(self .packfile_v2_3_ascii , self .packindexfile_v2_3_ascii )):
@@ -143,6 +149,7 @@ def test_pack_entity(self):
143
149
entity = PackEntity (packfile )
144
150
assert entity .pack ().path () == packfile
145
151
assert entity .index ().path () == indexfile
152
+ pack_iterators .append (entity .stream_iter ())
146
153
147
154
count = 0
148
155
for info , stream in izip (entity .info_iter (), entity .stream_iter ()):
@@ -174,9 +181,28 @@ def test_pack_entity(self):
174
181
# END for each info, stream tuple
175
182
assert count == size
176
183
177
- # END for each entity
184
+ # END for each entity
185
+
186
+ # pack writing - write all packs into one
187
+ # index path can be None
188
+ pack_path = tempfile .mktemp ('' , "pack" , rw_dir )
189
+ index_path = tempfile .mktemp ('' , 'index' , rw_dir )
190
+ for pp , ip in ((pack_path , )* 2 , (index_path , None )):
191
+ pfile = open (pp , 'wb' )
192
+ ifile = None
193
+ if ip :
194
+ ifile = open (ip , 'wb' )
195
+ #END handle ip
196
+
197
+ PackEntity .create (chain (* pack_iterators ), pfile , ifile )
198
+ assert os .path .getsize (pp ) > 100
199
+ if ip is not None :
200
+ assert os .path .getsize (ip ) > 100
201
+ #END verify files exist
202
+ #END for each packpath, indexpath pair
203
+
178
204
179
205
def test_pack_64 (self ):
180
206
# TODO: hex-edit a pack helping us to verify that we can handle 64 byte offsets
181
207
# of course without really needing such a huge pack
182
- pass
208
+ raise SkipTest ()
0 commit comments