MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_lchmod_link

Method check_lchmod_link

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

Source from the content-addressed store, hash-verified

1063 posix.chmod(target, target_mode)
1064
1065 def check_lchmod_link(self, chmod_func, target, link, **kwargs):
1066 target_mode = os.stat(target).st_mode
1067 link_mode = os.lstat(link).st_mode
1068 new_mode = link_mode & ~(stat.S_IWOTH | stat.S_IWGRP | stat.S_IWUSR)
1069 chmod_func(link, new_mode, **kwargs)
1070 self.assertEqual(os.stat(target).st_mode, target_mode)
1071 self.assertEqual(os.lstat(link).st_mode, new_mode)
1072 new_mode = link_mode | (stat.S_IWOTH | stat.S_IWGRP | stat.S_IWUSR)
1073 chmod_func(link, new_mode, **kwargs)
1074 self.assertEqual(os.stat(target).st_mode, target_mode)
1075 self.assertEqual(os.lstat(link).st_mode, new_mode)
1076
1077 @os_helper.skip_unless_symlink
1078 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