diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-12-17 08:36:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-17 08:36:36 (GMT) |
commit | 2cf4c202ffeb30787c944365ba54013688b854c2 (patch) | |
tree | aa98e69de819cb1cd0f5bd25fb10636f98001ff2 /Lib/test/test_signal.py | |
parent | 4e80f5cbeaee87a26e49bc9623c92a10e28dbbd9 (diff) | |
download | cpython-2cf4c202ffeb30787c944365ba54013688b854c2.zip cpython-2cf4c202ffeb30787c944365ba54013688b854c2.tar.gz cpython-2cf4c202ffeb30787c944365ba54013688b854c2.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).
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r-- | Lib/test/test_signal.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index d30a2d6..b10faa0 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -1163,18 +1163,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 @@ -1197,7 +1197,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 @@ -1207,7 +1207,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 |