summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_signal.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-12-17 09:03:04 (GMT)
committerGitHub <noreply@github.com>2018-12-17 09:03:04 (GMT)
commitbe69ff232df23b6ee165d7c34df5435d497cb79b (patch)
tree705a582be92252ef0b2ffb2ad245c92b27246a61 /Lib/test/test_signal.py
parent2d91a1325f7def1cc3762cadf5f5a99a55dac78a (diff)
downloadcpython-be69ff232df23b6ee165d7c34df5435d497cb79b.zip
cpython-be69ff232df23b6ee165d7c34df5435d497cb79b.tar.gz
cpython-be69ff232df23b6ee165d7c34df5435d497cb79b.tar.bz2
bpo-35513: Replace time.time() with time.monotonic() in tests (GH-11182)
Replace time.time() with time.monotonic() in tests to measure time delta. test_zipfile64: display progress every minute (60 secs) rather than every 5 minutes (5*60 seconds). (cherry picked from commit 2cf4c202ffeb30787c944365ba54013688b854c2) Co-authored-by: Victor Stinner <vstinner@redhat.com>
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r--Lib/test/test_signal.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 24cab0f..406684b 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -1122,18 +1122,18 @@ class StressTest(unittest.TestCase):
self.setsig(signal.SIGALRM, second_handler) # for ITIMER_REAL
expected_sigs = 0
- deadline = time.time() + 15.0
+ deadline = time.monotonic() + 15.0
while expected_sigs < N:
os.kill(os.getpid(), signal.SIGPROF)
expected_sigs += 1
# Wait for handlers to run to avoid signal coalescing
- while len(sigs) < expected_sigs and time.time() < deadline:
+ while len(sigs) < expected_sigs and time.monotonic() < deadline:
time.sleep(1e-5)
os.kill(os.getpid(), signal.SIGUSR1)
expected_sigs += 1
- while len(sigs) < expected_sigs and time.time() < deadline:
+ while len(sigs) < expected_sigs and time.monotonic() < deadline:
time.sleep(1e-5)
# All ITIMER_REAL signals should have been delivered to the
@@ -1156,7 +1156,7 @@ class StressTest(unittest.TestCase):
self.setsig(signal.SIGALRM, handler) # for ITIMER_REAL
expected_sigs = 0
- deadline = time.time() + 15.0
+ deadline = time.monotonic() + 15.0
while expected_sigs < N:
# Hopefully the SIGALRM will be received somewhere during
@@ -1166,7 +1166,7 @@ class StressTest(unittest.TestCase):
expected_sigs += 2
# Wait for handlers to run to avoid signal coalescing
- while len(sigs) < expected_sigs and time.time() < deadline:
+ while len(sigs) < expected_sigs and time.monotonic() < deadline:
time.sleep(1e-5)
# All ITIMER_REAL signals should have been delivered to the