Skip to content

Commit 668f3f1

Browse files
authored
Remove tests for process_time and thread_time (#4895)
1 parent ee06a44 commit 668f3f1

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

distributed/tests/test_metrics.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import sys
2-
import threading
31
import time
42

53
from distributed import metrics
6-
from distributed.utils_test import run_for
74

85

96
def test_wall_clock():
@@ -18,46 +15,3 @@ def test_wall_clock():
1815
assert any(lambda d: 0.0 < d < 0.0001 for d in deltas), deltas
1916
# Close to time.time()
2017
assert t - 0.5 < samples[0] < t + 0.5
21-
22-
23-
def test_process_time():
24-
start = metrics.process_time()
25-
run_for(0.05)
26-
dt = metrics.process_time() - start
27-
assert 0.03 <= dt <= 0.2
28-
29-
# All threads counted
30-
t = threading.Thread(target=run_for, args=(0.1,))
31-
start = metrics.process_time()
32-
t.start()
33-
t.join()
34-
dt = metrics.process_time() - start
35-
assert dt >= 0.05
36-
37-
# Sleep time not counted
38-
start = metrics.process_time()
39-
time.sleep(0.1)
40-
dt = metrics.process_time() - start
41-
assert dt <= 0.05
42-
43-
44-
def test_thread_time():
45-
start = metrics.thread_time()
46-
run_for(0.05)
47-
dt = metrics.thread_time() - start
48-
assert 0.03 <= dt <= 0.2
49-
50-
# Sleep time not counted
51-
start = metrics.thread_time()
52-
time.sleep(0.1)
53-
dt = metrics.thread_time() - start
54-
assert dt <= 0.05
55-
56-
if sys.platform == "linux":
57-
# Always per-thread on Linux
58-
t = threading.Thread(target=run_for, args=(0.1,))
59-
start = metrics.thread_time()
60-
t.start()
61-
t.join()
62-
dt = metrics.thread_time() - start
63-
assert dt <= 0.05

0 commit comments

Comments
 (0)