Skip to content

Commit 2b931b8

Browse files
committed
Address review comments (bare assert, don't use ceil())
1 parent 525c047 commit 2b931b8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Lib/subprocess.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import threading
5252
import warnings
5353
import contextlib
54-
import math
5554
import select
5655
from time import monotonic as _time
5756
import types
@@ -2121,7 +2120,7 @@ def _wait_pidfd(self, timeout):
21212120
try:
21222121
poller = select.poll()
21232122
poller.register(pidfd, select.POLLIN)
2124-
events = poller.poll(math.ceil(timeout * 1000))
2123+
events = poller.poll(timeout * 1000)
21252124
if not events:
21262125
raise TimeoutExpired(self.args, timeout)
21272126
return True
@@ -2147,7 +2146,7 @@ def _wait_kqueue(self, timeout):
21472146
)
21482147
try:
21492148
events = kq.control([kev], 1, timeout) # wait
2150-
except OSError as err: # should never happen
2149+
except OSError:
21512150
return False
21522151
else:
21532152
if not events:

Lib/test/test_subprocess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4114,7 +4114,7 @@ def assert_fast_waitpid_error(self, patch_point):
41144114
with self.assertRaises(subprocess.TimeoutExpired):
41154115
p.wait(timeout=0.0001)
41164116
self.assertEqual(p.wait(timeout=support.SHORT_TIMEOUT), 0)
4117-
assert m.called
4117+
self.assertTrue(m.called)
41184118

41194119
@unittest.skipIf(not CAN_USE_PIDFD_OPEN, reason="needs pidfd_open()")
41204120
def test_wait_pidfd_open_error(self):
@@ -4140,7 +4140,7 @@ def test_kqueue_control_error(self):
41404140
with self.assertRaises(subprocess.TimeoutExpired):
41414141
p.wait(timeout=0.0001)
41424142
self.assertEqual(p.wait(timeout=support.SHORT_TIMEOUT), 0)
4143-
assert m.called
4143+
self.assertTrue(m.called)
41444144

41454145
def assert_wait_race_condition(self, patch_target, real_func):
41464146
# Call pidfd_open() / kqueue(), then terminate the process.
@@ -4160,7 +4160,7 @@ def wrapper(*args, **kwargs):
41604160

41614161
with mock.patch(patch_target, side_effect=wrapper) as m:
41624162
status = p.wait(timeout=support.SHORT_TIMEOUT)
4163-
assert m.called
4163+
self.assertTrue(m.called)
41644164
self.assertEqual(status, 0)
41654165

41664166
@unittest.skipIf(not CAN_USE_PIDFD_OPEN, reason="needs pidfd_open()")

0 commit comments

Comments
 (0)