@@ -2658,6 +2658,15 @@ def test_unicode_name(self):
26582658
26592659@unittest .skipUnless (hasattr (os , 'linkat' ), 'requires os.linkat' )
26602660class LinkAtTests (unittest .TestCase ):
2661+ @staticmethod
2662+ def linkat (* args ):
2663+ try :
2664+ os .linkat (* args )
2665+ except OSError as exc :
2666+ if exc .errno == errno .ENOSYS :
2667+ self .skipTest (str (exc ))
2668+ raise
2669+
26612670 def test_no_flags (self ):
26622671 src = "linkat_src"
26632672 self .addCleanup (os_helper .unlink , src )
@@ -2666,13 +2675,11 @@ def test_no_flags(self):
26662675
26672676 dst = "linkat_dst"
26682677 self .addCleanup (os_helper .unlink , dst )
2669- os .linkat (os .AT_FDCWD , src , os .AT_FDCWD , dst ) # flags=0
2678+ self .linkat (os .AT_FDCWD , src , os .AT_FDCWD , dst ) # flags=0
26702679
26712680 with open (dst , encoding = 'utf8' ) as fp :
26722681 self .assertEqual (fp .read (), 'hello' )
26732682
2674- # linkat() fails with "OSError: [Errno 0]" on WASI
2675- @unittest .skipIf (support .is_wasi , 'test broken on WASI' )
26762683 def test_destination_exists (self ):
26772684 src = "linkat_src"
26782685 self .addCleanup (os_helper .unlink , src )
@@ -2683,7 +2690,7 @@ def test_destination_exists(self):
26832690 open (dst , "w" ).close ()
26842691
26852692 with self .assertRaises (FileExistsError ):
2686- os .linkat (os .AT_FDCWD , src , os .AT_FDCWD , dst ) # flags=0
2693+ self .linkat (os .AT_FDCWD , src , os .AT_FDCWD , dst ) # flags=0
26872694
26882695 @unittest .skipUnless (hasattr (os , 'O_TMPFILE' ), 'need os.O_TMPFILE' )
26892696 def check_flag (self , flag ):
0 commit comments