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

Method test_BoundedSemaphore_limit

Lib/test/test_threading.py:948–964  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

946 t.join()
947
948 def test_BoundedSemaphore_limit(self):
949 # BoundedSemaphore should raise ValueError if released too often.
950 for limit in range(1, 10):
951 bs = threading.BoundedSemaphore(limit)
952 threads = [threading.Thread(target=bs.acquire)
953 for _ in range(limit)]
954 for t in threads:
955 t.start()
956 for t in threads:
957 t.join()
958 threads = [threading.Thread(target=bs.release)
959 for _ in range(limit)]
960 for t in threads:
961 t.start()
962 for t in threads:
963 t.join()
964 self.assertRaises(ValueError, bs.release)
965
966 @cpython_only
967 def test_frame_tstate_tracing(self):

Callers

nothing calls this directly

Calls 4

BoundedSemaphoreMethod · 0.80
startMethod · 0.45
joinMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected