MCPcopy Index your code
hub / github.com/python/cpython / test_realpath_resolve_parents

Method test_realpath_resolve_parents

Lib/test/test_posixpath.py:751–767  ·  view source on GitHub ↗
(self, kwargs)

Source from the content-addressed store, hash-verified

749 @skip_if_ABSTFN_contains_backslash
750 @_parameterize({}, {'strict': ALL_BUT_LAST}, {'strict': ALLOW_MISSING})
751 def test_realpath_resolve_parents(self, kwargs):
752 # We also need to resolve any symlinks in the parents of a relative
753 # path passed to realpath. E.g.: current working directory is
754 # /usr/doc with 'doc' being a symlink to /usr/share/doc. We call
755 # realpath("a"). This should return /usr/share/doc/a/.
756 try:
757 os.mkdir(ABSTFN)
758 os.mkdir(ABSTFN + "/y")
759 os.symlink(ABSTFN + "/y", ABSTFN + "/k")
760
761 with os_helper.change_cwd(ABSTFN + "/k"):
762 self.assertEqual(realpath("a", **kwargs),
763 ABSTFN + "/y/a")
764 finally:
765 os_helper.unlink(ABSTFN + "/k")
766 os_helper.rmdir(ABSTFN + "/y")
767 os_helper.rmdir(ABSTFN)
768
769 @os_helper.skip_unless_symlink
770 @skip_if_ABSTFN_contains_backslash

Callers

nothing calls this directly

Calls 5

realpathFunction · 0.90
rmdirMethod · 0.80
mkdirMethod · 0.45
assertEqualMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected