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

Method check_lchmod_link

Lib/test/test_os/test_posix.py:1125–1135  ·  view source on GitHub ↗
(self, chmod_func, target, link, **kwargs)

Source from the content-addressed store, hash-verified

1123 posix.chmod(target, target_mode)
1124
1125 def check_lchmod_link(self, chmod_func, target, link, **kwargs):
1126 target_mode = os.stat(target).st_mode
1127 link_mode = os.lstat(link).st_mode
1128 new_mode = link_mode & ~(stat.S_IWOTH | stat.S_IWGRP | stat.S_IWUSR)
1129 chmod_func(link, new_mode, **kwargs)
1130 self.assertEqual(os.stat(target).st_mode, target_mode)
1131 self.assertEqual(os.lstat(link).st_mode, new_mode)
1132 new_mode = link_mode | (stat.S_IWOTH | stat.S_IWGRP | stat.S_IWUSR)
1133 chmod_func(link, new_mode, **kwargs)
1134 self.assertEqual(os.stat(target).st_mode, target_mode)
1135 self.assertEqual(os.lstat(link).st_mode, new_mode)
1136
1137 @os_helper.skip_unless_symlink
1138 def test_chmod_file_symlink(self):

Callers 4

Calls 4

chmod_funcFunction · 0.85
lstatMethod · 0.80
statMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected