MCPcopy
hub / github.com/treeverse/dvc / test_recursive

Method test_recursive

dvc/testing/workspace_tests.py:223–269  ·  view source on GitHub ↗
(self, cloud)

Source from the content-addressed store, hash-verified

221 )
222
223 def test_recursive(self, cloud):
224 cloud.gen({"dir/foo": "foo contents", "dir/subdir/bar": "bar contents"})
225 if not (cloud / "dir").is_dir():
226 pytest.skip("Cannot create directories on this cloud")
227 fs, _ = parse_external_url(cloud.url, cloud.config)
228 result = ls_url(str(cloud / "dir"), fs_config=cloud.config, recursive=True)
229 match_files(
230 fs,
231 result,
232 [
233 {"path": "foo", "isdir": False},
234 {"path": "subdir/bar", "isdir": False},
235 ],
236 )
237
238 result = ls_url(
239 str(cloud / "dir"), fs_config=cloud.config, recursive=True, maxdepth=0
240 )
241 match_files(
242 fs,
243 result,
244 [{"path": (cloud / "dir").fs_path, "isdir": False}],
245 )
246
247 result = ls_url(
248 str(cloud / "dir"), fs_config=cloud.config, recursive=True, maxdepth=1
249 )
250 match_files(
251 fs,
252 result,
253 [
254 {"path": "foo", "isdir": False},
255 {"path": "subdir", "isdir": True},
256 ],
257 )
258
259 result = ls_url(
260 str(cloud / "dir"), fs_config=cloud.config, recursive=True, maxdepth=2
261 )
262 match_files(
263 fs,
264 result,
265 [
266 {"path": "foo", "isdir": False},
267 {"path": "subdir/bar", "isdir": False},
268 ],
269 )
270
271 def test_nonexistent(self, cloud):
272 with pytest.raises(URLMissingError):

Callers

nothing calls this directly

Calls 5

ls_urlFunction · 0.90
parse_external_urlFunction · 0.85
is_dirMethod · 0.80
match_filesFunction · 0.70
genMethod · 0.45

Tested by

no test coverage detected