mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
- Issue #15238: shutil.copystat now copies Linux "extended attributes".
This commit is contained in:
parent
7c6309c6af
commit
ad5ae0456e
4 changed files with 37 additions and 24 deletions
|
@ -410,6 +410,16 @@ class TestShutil(unittest.TestCase):
|
|||
finally:
|
||||
os.setxattr = orig_setxattr
|
||||
|
||||
# test that shutil.copystat copies xattrs
|
||||
src = os.path.join(tmp_dir, 'the_original')
|
||||
write_file(src, src)
|
||||
os.setxattr(src, 'user.the_value', b'fiddly')
|
||||
dst = os.path.join(tmp_dir, 'the_copy')
|
||||
write_file(dst, dst)
|
||||
shutil.copystat(src, dst)
|
||||
self.assertEqual(os.listxattr(src), ['user.the_value'])
|
||||
self.assertEqual(os.getxattr(src, 'user.the_value'), b'fiddly')
|
||||
|
||||
@support.skip_unless_symlink
|
||||
@support.skip_unless_xattr
|
||||
@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue