@@ -1736,7 +1736,10 @@ def tearDown(self):
17361736 def _test_link (self , file1 , file2 ):
17371737 create_file (file1 )
17381738
1739- os .link (file1 , file2 )
1739+ try :
1740+ os .link (file1 , file2 )
1741+ except PermissionError as e :
1742+ self .skipTest ('os.link(): %s' % e )
17401743 with open (file1 , "r" ) as f1 , open (file2 , "r" ) as f2 :
17411744 self .assertTrue (os .path .sameopenfile (f1 .fileno (), f2 .fileno ()))
17421745
@@ -2888,7 +2891,8 @@ def test_stty_match(self):
28882891 """
28892892 try :
28902893 size = subprocess .check_output (['stty' , 'size' ]).decode ().split ()
2891- except (FileNotFoundError , subprocess .CalledProcessError ):
2894+ except (FileNotFoundError , subprocess .CalledProcessError ,
2895+ PermissionError ):
28922896 self .skipTest ("stty invocation failed" )
28932897 expected = (int (size [1 ]), int (size [0 ])) # reversed order
28942898
@@ -3242,7 +3246,10 @@ def test_attributes(self):
32423246 os .mkdir (dirname )
32433247 filename = self .create_file ("file.txt" )
32443248 if link :
3245- os .link (filename , os .path .join (self .path , "link_file.txt" ))
3249+ try :
3250+ os .link (filename , os .path .join (self .path , "link_file.txt" ))
3251+ except PermissionError as e :
3252+ self .skipTest ('os.link(): %s' % e )
32463253 if symlink :
32473254 os .symlink (dirname , os .path .join (self .path , "symlink_dir" ),
32483255 target_is_directory = True )
0 commit comments