diff -r 875ba78bee10 Lib/test/test_posix.py --- a/Lib/test/test_posix.py Sun May 06 19:24:18 2012 +0200 +++ b/Lib/test/test_posix.py Tue Aug 21 05:07:47 2012 +0000 @@ -535,7 +535,17 @@ def _test_chflags_regular_file(self, chflags_func, target_file): st = os.stat(target_file) self.assertTrue(hasattr(st, 'st_flags')) - chflags_func(target_file, st.st_flags | stat.UF_IMMUTABLE) + + # Some filesystems, like ZFS, don't support any of the traditional + # chflags operations, and will always return EOPNOTSUPP. + try: + chflags_func(target_file, st.st_flags | stat.UF_IMMUTABLE) + except OSError as err: + if err.errno == errno.EOPNOTSUPP: + msg = 'chflag uimmutable not supported by underlying fs' + self.skipTest(msg) + raise + try: new_st = os.stat(target_file) self.assertEqual(st.st_flags | stat.UF_IMMUTABLE, new_st.st_flags) @@ -564,8 +574,17 @@ self.teardown_files.append(_DUMMY_SYMLINK) dummy_symlink_st = os.lstat(_DUMMY_SYMLINK) - posix.lchflags(_DUMMY_SYMLINK, - dummy_symlink_st.st_flags | stat.UF_IMMUTABLE) + # Some filesystems, like ZFS, don't support any of the traditional + # chflags operations, and will always return EOPNOTSUPP. + try: + posix.lchflags(_DUMMY_SYMLINK, + dummy_symlink_st.st_flags | stat.UF_IMMUTABLE) + except OSError as err: + if err.errno == errno.EOPNOTSUPP: + msg = 'chflag uimmutable not supported by underlying fs' + self.skipTest(msg) + raise + try: new_testfn_st = os.stat(support.TESTFN) new_dummy_symlink_st = os.lstat(_DUMMY_SYMLINK)