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

Method move

src/_pytest/_py/path.py:402–410  ·  view source on GitHub ↗

Move this path to target.

(self, target)

Source from the content-addressed store, hash-verified

400 f.close()
401
402 def move(self, target):
403 """Move this path to target."""
404 if target.relto(self):
405 raise error.EINVAL(target, "cannot move path into a subdirectory of itself")
406 try:
407 self.rename(target)
408 except error.EXDEV: # invalid cross-device link
409 self.copy(target)
410 self.remove()
411
412 def fnmatch(self, pattern):
413 """Return true if the basename/fullname matches the glob-'pattern'.

Callers 3

test_move_fileMethod · 0.80
test_move_dirMethod · 0.80

Calls 4

renameMethod · 0.95
copyMethod · 0.95
removeMethod · 0.95
reltoMethod · 0.45

Tested by 3

test_move_fileMethod · 0.64
test_move_dirMethod · 0.64