@@ -2659,7 +2659,6 @@ def test_unicode_name(self):
26592659@unittest .skipUnless (hasattr (os , 'linkat' ), 'requires os.linkat' )
26602660class LinkAtTests (unittest .TestCase ):
26612661 def test_no_flags (self ):
2662- # create hard link with no flags
26632662 src = "linkat_src"
26642663 self .addCleanup (os_helper .unlink , src )
26652664 with open (src , "w" , encoding = 'utf8' ) as fp :
@@ -2672,14 +2671,19 @@ def test_no_flags(self):
26722671 with open (dst , encoding = 'utf8' ) as fp :
26732672 self .assertEqual (fp .read (), 'hello' )
26742673
2675- # destination already exists
2676- src2 = "linkat_src2"
2677- self .addCleanup (os_helper .unlink , src2 )
2678- with open (src2 , "w" , encoding = 'utf8' ) as fp :
2679- fp .write ("PYTHON" )
2674+ # linkat() fails with "OSError: [Errno 0]" on WASI
2675+ @unittest .skipIf (support .is_wasi , 'test broken on WASI' )
2676+ def test_destination_exists (self ):
2677+ src = "linkat_src"
2678+ self .addCleanup (os_helper .unlink , src )
2679+ open (src , "w" ).close ()
2680+
2681+ dst = "linkat_dst"
2682+ self .addCleanup (os_helper .unlink , dst )
2683+ open (dst , "w" ).close ()
26802684
26812685 with self .assertRaises (FileExistsError ):
2682- os .linkat (os .AT_FDCWD , src2 , os .AT_FDCWD , dst ) # flags=0
2686+ os .linkat (os .AT_FDCWD , src , os .AT_FDCWD , dst ) # flags=0
26832687
26842688 @unittest .skipUnless (hasattr (os , 'O_TMPFILE' ), 'need os.O_TMPFILE' )
26852689 def check_flag (self , flag ):
0 commit comments