MCPcopy
hub / github.com/pytest-dev/pytest / parts

Method parts

src/_pytest/_py/path.py:489–503  ·  view source on GitHub ↗

Return a root-first list of all ancestor directories plus the path itself.

(self, reverse=False)

Source from the content-addressed store, hash-verified

487 return self.check(file=1)
488
489 def parts(self, reverse=False):
490 """Return a root-first list of all ancestor directories
491 plus the path itself.
492 """
493 current = self
494 lst = [self]
495 while 1:
496 last = current
497 current = current.dirpath()
498 if last == current:
499 break
500 lst.append(current)
501 if not reverse:
502 lst.reverse()
503 return lst
504
505 def common(self, other):
506 """Return the common part shared with the other path

Callers 4

commonMethod · 0.95
pypkgpathMethod · 0.95
test_partsMethod · 0.80
test_join_to_rootMethod · 0.80

Calls 2

dirpathMethod · 0.80
appendMethod · 0.80

Tested by 2

test_partsMethod · 0.64
test_join_to_rootMethod · 0.64