Skip to content

Commit 2d2b152

Browse files
adswamih
authored andcommitted
test: enable zip testing
1 parent 54d783f commit 2d2b152

File tree

1 file changed

+13
-44
lines changed

1 file changed

+13
-44
lines changed

datalad_next/annexremotes/tests/test_archivist.py

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ def populated_archivist_dataset(
6969

7070
akeys = {}
7171

72-
# no ZIP just yet
73-
# for archivetype, ext in (('zip', ''), ('tar', '.gz')):
74-
for archivetype, ext in (('tar', '.gz'), ):
72+
for archivetype, ext in (('zip', ''), ('tar', '.gz')):
7573
archive_path = Path(f"{archive_root}.{archivetype}{ext}")
7674

7775
archive_path_inds = ads.pathobj / '.archives' / archive_path.name
@@ -128,9 +126,7 @@ def _check_archivist_retrieval(archivist_dataset):
128126
# step 1: addurl
129127
_check_archivist_addurl(
130128
# check all archive types supported
131-
# no ZIP just yet
132-
#('zip', 'tar'),
133-
('tar',),
129+
('zip', 'tar'),
134130
ads, akeys, archive_root, dscontent,
135131
)
136132

@@ -142,36 +138,25 @@ def _check_archivist_retrieval(archivist_dataset):
142138
# because for each file there is a URL on record
143139
# -- hence always another copy
144140
# this requires archivist's CHECKPRESENT to function properly
145-
# no ZIP just yet
146-
#res = ads.drop(['azip', 'atar'])
147-
res = ads.drop(['atar'])
141+
res = ads.drop(['azip', 'atar'])
148142
assert_result_count(
149143
res,
150144
# all files, plus the two directories we gave as arguments
151-
# no ZIP just yet
152-
#len(dscontent) + 2,
153-
3,
145+
len(dscontent) + 2,
154146
action='drop',
155147
status='ok',
156148
)
157149

158150
# step 3: retrieve keys with dl+archive: URLs from locally present archives
159-
# no ZIP just yet
160-
#res = ads.get(['azip', 'atar'])
161-
res = ads.get(['atar'])
151+
res = ads.get(['azip', 'atar'])
162152
assert_result_count(
163153
res,
164-
# no ZIP just yet
165-
# len(dscontent),
166-
2,
154+
len(dscontent),
167155
action='get',
168156
status='ok',
169157
type='file',
170158
)
171159
for fpath, fcontent in dscontent:
172-
# no ZIP just yet
173-
if 'zip' in fpath:
174-
continue
175160
assert (ads.pathobj / fpath).read_text() == fcontent
176161

177162
# step 4: now drop ALL keys (incl. archives)
@@ -183,43 +168,31 @@ def _check_archivist_retrieval(archivist_dataset):
183168
assert_result_count(
184169
res,
185170
# a tar and a zip
186-
# no ZIP just yet
187-
#2,
188-
1,
171+
2,
189172
action='drop',
190173
type='file',
191174
status='ok',
192175
)
193176
# and 4a now drop the keys that have their content from archives
194-
# no ZIP just yet
195-
#res = ads.drop(['azip', 'atar'])
196-
res = ads.drop(['atar'])
177+
res = ads.drop(['azip', 'atar'])
197178
assert_result_count(
198179
res,
199-
# no ZIP just yet
200-
#len(dscontent),
201-
2,
180+
len(dscontent),
202181
action='drop',
203182
status='ok',
204183
type='file',
205184
)
206185
# and now get again, this time with no archives around locally
207-
# no ZIP just yet
208-
#res = ads.get(['azip', 'atar'])
209-
res = ads.get(['atar'])
186+
res = ads.get(['azip', 'atar'])
210187
assert_result_count(
211188
res,
212189
# no ZIP just yet
213-
# len(dscontent),
214-
2,
190+
len(dscontent),
215191
action='get',
216192
status='ok',
217193
type='file',
218194
)
219195
for fpath, fcontent in dscontent:
220-
# no ZIP just yet
221-
if 'zip' in fpath:
222-
continue
223196
assert (ads.pathobj / fpath).read_text() == fcontent
224197
# and drop everything again to leave the dataset empty
225198
res = ads.drop(['.'])
@@ -237,15 +210,11 @@ def test_archivist_retrieval(populated_archivist_dataset, no_result_rendering):
237210
for archive in archive_root.parent.glob('*.*z*'):
238211
archive.unlink()
239212
with pytest.raises(CommandError) as e:
240-
# no ZIP just yet
241-
#ads.repo.call_annex(['get', 'atar', 'azip'])
242-
ads.repo.call_annex(['get', 'atar'])
213+
ads.repo.call_annex(['get', 'atar', 'azip'])
243214
# make sure the "reason" is communicated outwards
244215
assert 'does not exist' in e.value.stderr
245216
with pytest.raises(CommandError):
246-
# no ZIP just yet
247-
#ads.repo.call_annex(['fsck', '-f', 'archivist', 'atar', 'azip'])
248-
ads.repo.call_annex(['fsck', '-f', 'archivist', 'atar'])
217+
ads.repo.call_annex(['fsck', '-f', 'archivist', 'atar', 'azip'])
249218

250219

251220
def test_archivist_retrieval_legacy(

0 commit comments

Comments
 (0)