MCPcopy Create free account
hub / github.com/ashleve/rootutils / test_find_root

Function test_find_root

tests/test_rootutils.py:16–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14
15
16def test_find_root():
17 path = find_root()
18 assert path.exists()
19
20 path = find_root("")
21 assert path.exists()
22
23 path = find_root(".")
24 assert path.exists()
25
26 path = find_root(__file__)
27 assert path.exists()
28
29 path = find_root(str(__file__))
30 assert path.exists()
31
32 path = find_root(Path(__file__))
33 assert path.exists()
34
35 path = find_root(__file__, ".git")
36 assert path.exists()
37
38 path = find_root(__file__, indicator=[".setup.cfg", "setup.py", "LICENSE"])
39 assert path.exists()
40
41 with pytest.raises(FileNotFoundError):
42 path = find_root(__file__, indicator="abc")
43
44 with pytest.raises(FileNotFoundError):
45 path = find_root(__file__, indicator=["abc", "def", "fgh"])
46
47 with pytest.raises(FileNotFoundError):
48 path = find_root(Path(__file__).parent.parent.parent)
49
50 with pytest.raises(TypeError):
51 path = find_root([])
52
53 with pytest.raises(TypeError):
54 path = find_root("", ["abs", "def", 42])
55
56
57def test_set_root():

Callers

nothing calls this directly

Calls 1

find_rootFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…