MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_set_and_clear

Method test_set_and_clear

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

Source from the content-addressed store, hash-verified

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