MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __init__

Method __init__

src/_pytest/nodes.py:569–621  ·  view source on GitHub ↗
(
        self,
        fspath: Optional[LEGACY_PATH] = None,
        path_or_parent: Optional[Union[Path, Node]] = None,
        path: Optional[Path] = None,
        name: Optional[str] = None,
        parent: Optional[Node] = None,
        config: Optional[Config] = None,
        session: Optional["Session"] = None,
        nodeid: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

567
568class FSCollector(Collector):
569 def __init__(
570 self,
571 fspath: Optional[LEGACY_PATH] = None,
572 path_or_parent: Optional[Union[Path, Node]] = None,
573 path: Optional[Path] = None,
574 name: Optional[str] = None,
575 parent: Optional[Node] = None,
576 config: Optional[Config] = None,
577 session: Optional["Session"] = None,
578 nodeid: Optional[str] = None,
579 ) -> None:
580 if path_or_parent:
581 if isinstance(path_or_parent, Node):
582 assert parent is None
583 parent = cast(FSCollector, path_or_parent)
584 elif isinstance(path_or_parent, Path):
585 assert path is None
586 path = path_or_parent
587
588 path = _imply_path(type(self), path, fspath=fspath)
589 if name is None:
590 name = path.name
591 if parent is not None and parent.path != path:
592 try:
593 rel = path.relative_to(parent.path)
594 except ValueError:
595 pass
596 else:
597 name = str(rel)
598 name = name.replace(os.sep, SEP)
599 self.path = path
600
601 if session is None:
602 assert parent is not None
603 session = parent.session
604
605 if nodeid is None:
606 try:
607 nodeid = str(self.path.relative_to(session.config.rootpath))
608 except ValueError:
609 nodeid = _check_initialpaths_for_relpath(session, path)
610
611 if nodeid and os.sep != SEP:
612 nodeid = nodeid.replace(os.sep, SEP)
613
614 super().__init__(
615 name=name,
616 parent=parent,
617 config=config,
618 session=session,
619 nodeid=nodeid,
620 path=path,
621 )
622
623 @classmethod
624 def from_parent(

Callers

nothing calls this directly

Calls 3

_imply_pathFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected