MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_threading

Function test_threading

tests/test_iostream.py:313–329  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

311
312@pytest.mark.skipif(sys.platform.startswith("emscripten"), reason="Requires threads")
313def test_threading():
314 with m.ostream_redirect(stdout=True, stderr=False):
315 # start some threads
316 threads = [m.TestThread() for _j in range(20)]
317
318 # give the threads some time to fail
319 threads[0].sleep()
320
321 # stop all the threads
322 for t in threads:
323 t.stop()
324
325 for t in threads:
326 t.join()
327
328 # if a thread segfaults, we don't get here
329 assert True

Callers

nothing calls this directly

Calls 4

TestThreadMethod · 0.80
sleepMethod · 0.80
stopMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected