@@ -312,8 +312,7 @@ def onerror(*args):
312312
313313 @unittest .skipIf (sys .platform [:6 ] == 'cygwin' ,
314314 "This test can't be run on Cygwin (issue #1071513)." )
315- @unittest .skipIf (hasattr (os , 'geteuid' ) and os .geteuid () == 0 ,
316- "This test can't be run reliably as root (issue #1076467)." )
315+ @os_helper .skip_if_dac_override
317316 @os_helper .skip_unless_working_chmod
318317 def test_on_error (self ):
319318 self .errorState = 0
@@ -1033,8 +1032,7 @@ def _raise_on_src(fname, *, follow_symlinks=True):
10331032
10341033 @os_helper .skip_unless_symlink
10351034 @os_helper .skip_unless_xattr
1036- @unittest .skipUnless (hasattr (os , 'geteuid' ) and os .geteuid () == 0 ,
1037- 'root privileges required' )
1035+ @os_helper .skip_unless_dac_override
10381036 def test_copyxattr_symlinks (self ):
10391037 # On Linux, it's only possible to access non-user xattr for symlinks;
10401038 # which in turn require root privileges. This test should be expanded
@@ -1830,8 +1828,7 @@ def test_cwd(self):
18301828 # Other platforms: shouldn't match in the current directory.
18311829 self .assertIsNone (rv )
18321830
1833- @unittest .skipIf (hasattr (os , 'geteuid' ) and os .geteuid () == 0 ,
1834- 'non-root user required' )
1831+ @os_helper .skip_if_dac_override
18351832 def test_non_matching_mode (self ):
18361833 # Set the file read-only and ask for writeable files.
18371834 os .chmod (self .temp_file .name , stat .S_IREAD )
@@ -2182,11 +2179,11 @@ def test_move_dir_caseinsensitive(self):
21822179 os .rmdir (dst_dir )
21832180
21842181
2185- @unittest . skipUnless ( hasattr ( os , 'geteuid' ) and os . geteuid () == 0
2186- and hasattr (os , 'lchflags' )
2182+ @os_helper . skip_unless_dac_override
2183+ @ unittest . skipUnless ( hasattr (os , 'lchflags' )
21872184 and hasattr (stat , 'SF_IMMUTABLE' )
21882185 and hasattr (stat , 'UF_OPAQUE' ),
2189- 'root privileges required ' )
2186+ 'requires lchflags ' )
21902187 def test_move_dir_permission_denied (self ):
21912188 # bpo-42782: shutil.move should not create destination directories
21922189 # if the source directory cannot be removed.
0 commit comments