bpo-39047: Skip chflags UF_IMMUTABLE tests if EOPNOTSUPP is raised.
This is necessary for ZFS systems, which don't support UF_IMMUTABLE.
This commit is contained in:
parent
94d2c8df1a
commit
8872f3b8e6
|
@ -1493,10 +1493,19 @@ class TestTemporaryDirectory(BaseTestCase):
|
||||||
d = self.do_create(recurse=3, dirs=2, files=2)
|
d = self.do_create(recurse=3, dirs=2, files=2)
|
||||||
with d:
|
with d:
|
||||||
# Change files and directories flags recursively.
|
# Change files and directories flags recursively.
|
||||||
for root, dirs, files in os.walk(d.name, topdown=False):
|
# ZFS returns EOPNOTSUPP when attempting to set flag
|
||||||
for name in files:
|
# UF_IMMUTABLE or UF_NOUNLINK.
|
||||||
os.chflags(os.path.join(root, name), flags)
|
try:
|
||||||
os.chflags(root, flags)
|
for root, dirs, files in os.walk(d.name, topdown=False):
|
||||||
|
for name in files:
|
||||||
|
os.chflags(os.path.join(root, name), flags)
|
||||||
|
os.chflags(root, flags)
|
||||||
|
except OSError as err:
|
||||||
|
if err.errno != errno.EOPNOTSUPP:
|
||||||
|
raise
|
||||||
|
msg = 'chflag UF_IMMUTABLE | UF_NONUNLINK not ' \
|
||||||
|
'supported by underlying fs'
|
||||||
|
self.skipTest(msg)
|
||||||
d.cleanup()
|
d.cleanup()
|
||||||
self.assertFalse(os.path.exists(d.name))
|
self.assertFalse(os.path.exists(d.name))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue