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

Method chdir

src/_pytest/_py/path.py:995–1002  ·  view source on GitHub ↗

Change directory to self and return old current directory

(self)

Source from the content-addressed store, hash-verified

993 return error.checked_call(os.utime, self.strpath, (self.atime(), mtime))
994
995 def chdir(self):
996 """Change directory to self and return old current directory"""
997 try:
998 old = self.__class__()
999 except error.ENOENT:
1000 old = None
1001 error.checked_call(os.chdir, self.strpath)
1002 return old
1003
1004 @contextmanager
1005 def as_cwd(self):

Callers 1

as_cwdMethod · 0.95

Calls 2

checked_callMethod · 0.80
__class__Method · 0.45

Tested by

no test coverage detected