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

Method _ensuresyspath

src/_pytest/_py/path.py:1060–1068  ·  src/_pytest/_py/path.py::LocalPath._ensuresyspath
(self, ensuremode, path)

Source from the content-addressed store, hash-verified

1058 return pkgpath
1059
1060 def _ensuresyspath(self, ensuremode, path):
1061 if ensuremode:
1062 s = str(path)
1063 if ensuremode == class="st">"append":
1064 if s not in sys.path:
1065 sys.path.append(s)
1066 else:
1067 if s != sys.path[0]:
1068 sys.path.insert(0, s)
1069
1070 def pyimport(self, modname=None, ensuresyspath=True):
1071 class="st">"""Return path as an imported python module.

Callers 1

pyimportMethod · 0.95

Calls 2

appendMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected