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

Function test_ls_tree

tests/func/test_ls.py:840–888  ·  view source on GitHub ↗
(tmp_dir, scm, dvc)

Source from the content-addressed store, hash-verified

838
839
840def test_ls_tree(tmp_dir, scm, dvc):
841 tmp_dir.scm_gen(FS_STRUCTURE, commit="init")
842 tmp_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")
843
844 files = ls_tree(os.fspath(tmp_dir), "structure.xml")
845 assert _simplify_tree(files) == {"structure.xml": None}
846
847 files = ls_tree(os.fspath(tmp_dir))
848
849 expected = {
850 ".": {
851 ".dvcignore": None,
852 ".gitignore": None,
853 "README.md": None,
854 "data": {
855 "subcontent": {
856 ".gitignore": None,
857 "data.xml": None,
858 "data.xml.dvc": None,
859 "statistics": {
860 ".gitignore": None,
861 "data.csv": None,
862 "data.csv.dvc": None,
863 },
864 }
865 },
866 "model": {
867 ".gitignore": None,
868 "people.csv": None,
869 "people.csv.dvc": None,
870 "script.py": None,
871 "train.py": None,
872 },
873 "structure.xml": None,
874 "structure.xml.dvc": None,
875 }
876 }
877 assert _simplify_tree(files) == expected
878
879 files = ls_tree(os.fspath(tmp_dir), "model")
880 assert _simplify_tree(files) == {
881 "model": {
882 ".gitignore": None,
883 "people.csv": None,
884 "people.csv.dvc": None,
885 "script.py": None,
886 "train.py": None,
887 }
888 }
889
890
891def test_ls_tree_dvc_only(tmp_dir, scm, dvc):

Callers

nothing calls this directly

Calls 5

ls_treeFunction · 0.90
_simplify_treeFunction · 0.85
scm_genMethod · 0.80
dvc_genMethod · 0.80
fspathMethod · 0.45

Tested by

no test coverage detected