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

Function _imply_path

src/_pytest/nodes.py:104–122  ·  view source on GitHub ↗
(
    node_type: Type["Node"],
    path: Optional[Path],
    fspath: Optional[LEGACY_PATH],
)

Source from the content-addressed store, hash-verified

102
103
104def _imply_path(
105 node_type: Type["Node"],
106 path: Optional[Path],
107 fspath: Optional[LEGACY_PATH],
108) -> Path:
109 if fspath is not None:
110 warnings.warn(
111 NODE_CTOR_FSPATH_ARG.format(
112 node_type_name=node_type.__name__,
113 ),
114 stacklevel=3,
115 )
116 if path is not None:
117 if fspath is not None:
118 _check_path(path, fspath)
119 return path
120 else:
121 assert fspath is not None
122 return Path(fspath)
123
124
125_NodeType = TypeVar("_NodeType", bound="Node")

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls 3

_check_pathFunction · 0.85
warnMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected