MCPcopy Create free account
hub / github.com/dask/dask / test_threaded_within_thread

Function test_threaded_within_thread

dask/tests/test_threaded.py:81–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79
80
81def test_threaded_within_thread():
82 L = []
83
84 def f(i):
85 result = get({"x": (lambda: i,)}, "x", num_workers=2)
86 L.append(result)
87
88 before = threading.active_count()
89
90 for _ in range(20):
91 t = threading.Thread(target=f, args=(1,))
92 t.daemon = True
93 t.start()
94 t.join()
95 assert L == [1]
96 del L[:]
97
98 start = time() # wait for most threads to join
99 while threading.active_count() > before + 10:
100 sleep(0.01)
101 assert time() < start + 5
102
103
104def test_dont_spawn_too_many_threads():

Callers

nothing calls this directly

Calls 2

startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected