@@ -184,7 +184,7 @@ def test_truncate(self):
184
184
posix .truncate (os_helper .TESTFN , 0 )
185
185
186
186
@unittest .skipUnless (getattr (os , 'execve' , None ) in os .supports_fd , "test needs execve() to support the fd parameter" )
187
- @unittest . skipUnless ( hasattr ( os , 'fork' ), "test needs os.fork()" )
187
+ @support . requires_fork ( )
188
188
def test_fexecve (self ):
189
189
fp = os .open (sys .executable , os .O_RDONLY )
190
190
try :
@@ -199,7 +199,7 @@ def test_fexecve(self):
199
199
200
200
201
201
@unittest .skipUnless (hasattr (posix , 'waitid' ), "test needs posix.waitid()" )
202
- @unittest . skipUnless ( hasattr ( os , 'fork' ), "test needs os.fork()" )
202
+ @support . requires_fork ( )
203
203
def test_waitid (self ):
204
204
pid = os .fork ()
205
205
if pid == 0 :
@@ -209,7 +209,7 @@ def test_waitid(self):
209
209
res = posix .waitid (posix .P_PID , pid , posix .WEXITED )
210
210
self .assertEqual (pid , res .si_pid )
211
211
212
- @unittest . skipUnless ( hasattr ( os , 'fork' ), "test needs os.fork()" )
212
+ @support . requires_fork ( )
213
213
def test_register_at_fork (self ):
214
214
with self .assertRaises (TypeError , msg = "Positional args not allowed" ):
215
215
os .register_at_fork (lambda : None )
@@ -1056,6 +1056,7 @@ def test_getgrouplist(self):
1056
1056
1057
1057
@unittest .skipUnless (hasattr (os , 'getegid' ), "test needs os.getegid()" )
1058
1058
@unittest .skipUnless (hasattr (os , 'popen' ), "test needs os.popen()" )
1059
+ @support .requires_subprocess ()
1059
1060
def test_getgroups (self ):
1060
1061
with os .popen ('id -G 2>/dev/null' ) as idg :
1061
1062
groups = idg .read ().strip ()
@@ -1481,7 +1482,7 @@ def test_unlink_dir_fd(self):
1481
1482
self .addCleanup (posix .unlink , fullname )
1482
1483
raise
1483
1484
1484
- @unittest .skipUnless (os .mkfifo in os .supports_dir_fd , "test needs dir_fd support in os.mkfifo()" )
1485
+ @unittest .skipUnless (hasattr ( os , 'mkfifo' ) and os .mkfifo in os .supports_dir_fd , "test needs dir_fd support in os.mkfifo()" )
1485
1486
def test_mkfifo_dir_fd (self ):
1486
1487
with self .prepare () as (dir_fd , name , fullname ):
1487
1488
try :
0 commit comments