@@ -1867,7 +1867,9 @@ def test_walk_bad_dir2(self):
18671867
18681868 walk_it = self .walk (self .tmp1_path , follow_symlinks = True )
18691869 if self .is_fwalk :
1870- self .assertRaises (NotADirectoryError , next , walk_it )
1870+ with self .assertRaises (OSError ) as cm :
1871+ next (walk_it )
1872+ self .assertIn (cm .exception .errno , (errno .ENOTDIR , errno .EINVAL ))
18711873 self .assertRaises (StopIteration , next , walk_it )
18721874
18731875 @unittest .skipUnless (hasattr (os , "mkfifo" ), 'requires os.mkfifo()' )
@@ -2269,6 +2271,8 @@ def test_chown_with_root(self):
22692271
22702272 @requires_non_root_user
22712273 @unittest .skipUnless (len (all_users ) > 1 , "test needs and more than one user" )
2274+ @unittest .skipIf (sys .platform == 'cygwin' ,
2275+ 'chown() can set any uid on Cygwin' )
22722276 def test_chown_without_permission (self ):
22732277 uid_1 , uid_2 = all_users [:2 ]
22742278 gid = os .stat (os_helper .TESTFN ).st_gid
@@ -4051,10 +4055,11 @@ def test_timerfd_non_blocking(self):
40514055 initial_expiration = 0.1
40524056 os .timerfd_settime (fd , initial = initial_expiration , interval = 0 )
40534057
4054- # read() raises OSError with errno is EAGAIN for non-blocking timer.
4055- with self .assertRaises (OSError ) as ctx :
4056- self .read_count_signaled (fd )
4057- self .assertEqual (ctx .exception .errno , errno .EAGAIN )
4058+ if sys .platform != 'cygwin' :
4059+ # read() raises OSError with errno is EAGAIN for non-blocking timer.
4060+ with self .assertRaises (OSError ) as ctx :
4061+ self .read_count_signaled (fd )
4062+ self .assertEqual (ctx .exception .errno , errno .EAGAIN )
40584063
40594064 # Wait more than 0.1 seconds
40604065 time .sleep (initial_expiration + 0.1 )
@@ -4235,12 +4240,19 @@ def test_timerfd_ns_initval(self):
42354240
42364241 # 2nd call
42374242 next_expiration_ns , interval_ns2 = os .timerfd_settime_ns (fd , initial = initial_expiration_ns , interval = interval_ns )
4238- self .assertEqual (interval_ns2 , interval_ns )
4243+ CYGWIN = (sys .platform == 'cygwin' )
4244+ if not CYGWIN :
4245+ self .assertEqual (interval_ns2 , interval_ns )
4246+ else :
4247+ self .assertEqual (interval_ns2 , 0 )
42394248 self .assertEqual (next_expiration_ns , initial_expiration_ns )
42404249
42414250 # timerfd_gettime
42424251 next_expiration_ns , interval_ns2 = os .timerfd_gettime_ns (fd )
4243- self .assertEqual (interval_ns2 , interval_ns )
4252+ if not CYGWIN :
4253+ self .assertEqual (interval_ns2 , interval_ns )
4254+ else :
4255+ self .assertEqual (interval_ns2 , 0 )
42444256 self .assertLessEqual (next_expiration_ns , initial_expiration_ns )
42454257
42464258 self .assertAlmostEqual (next_expiration_ns , initial_expiration_ns , delta = limit_error )
0 commit comments