mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-113086: Add tests for os.chmod() and os.lchmod() (GH-113087)
Also make test_copymode_symlink_to_symlink in test_shutil more strict.
This commit is contained in:
parent
fddc829236
commit
b4f2c89118
2 changed files with 118 additions and 1 deletions
|
@ -1132,10 +1132,11 @@ class TestCopy(BaseTest, unittest.TestCase):
|
|||
os.lchmod(src_link, stat.S_IRWXO|stat.S_IRWXG)
|
||||
# link to link
|
||||
os.lchmod(dst_link, stat.S_IRWXO)
|
||||
old_mode = os.stat(dst).st_mode
|
||||
shutil.copymode(src_link, dst_link, follow_symlinks=False)
|
||||
self.assertEqual(os.lstat(src_link).st_mode,
|
||||
os.lstat(dst_link).st_mode)
|
||||
self.assertNotEqual(os.stat(src).st_mode, os.stat(dst).st_mode)
|
||||
self.assertEqual(os.stat(dst).st_mode, old_mode)
|
||||
# src link - use chmod
|
||||
os.lchmod(dst_link, stat.S_IRWXO)
|
||||
shutil.copymode(src_link, dst, follow_symlinks=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue