Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-39047: Skip chflags UF_IMMUTABLE tests if EOPNOTSUPP is raised. (GH-17607) #17607

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Lib/test/test_tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,10 +1493,19 @@ def test_flags(self):
d = self.do_create(recurse=3, dirs=2, files=2)
with d:
# Change files and directories flags recursively.
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)
# ZFS returns EOPNOTSUPP when attempting to set flag
# UF_IMMUTABLE or UF_NOUNLINK.
try:
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()
self.assertFalse(os.path.exists(d.name))

Expand Down