MCPcopy Index your code
hub / github.com/python/cpython / test_set_and_clear

Method test_set_and_clear

Lib/test/lock_tests.py:565–582  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

563 self.assertTrue(r)
564
565 def test_set_and_clear(self):
566 # gh-57711: check that wait() returns true even when the event is
567 # cleared before the waiting thread is woken up.
568 event = self.eventtype()
569 results = []
570 def f():
571 results.append(event.wait(support.LONG_TIMEOUT))
572
573 N = 5
574 with Bunch(f, N):
575 # Threads blocked on event.wait()
576 wait_threads_blocked(N)
577
578 # Threads unblocked
579 event.set()
580 event.clear()
581
582 self.assertEqual(results, [True] * N)
583
584 @requires_fork
585 def test_at_fork_reinit(self):

Callers

nothing calls this directly

Calls 5

wait_threads_blockedFunction · 0.85
BunchClass · 0.70
setMethod · 0.45
clearMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected