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

Method test_locked_with_2threads

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

Source from the content-addressed store, hash-verified

391 self.assertFalse(lock.locked())
392
393 def test_locked_with_2threads(self):
394 # see gh-134323: check that a rlock which
395 # is acquired in a different thread,
396 # is still locked in the main thread.
397 result = []
398 rlock = self.locktype()
399 self.assertFalse(rlock.locked())
400 def acquire():
401 result.append(rlock.locked())
402 rlock.acquire()
403 result.append(rlock.locked())
404
405 with Bunch(acquire, 1):
406 pass
407 self.assertTrue(rlock.locked())
408 self.assertFalse(result[0])
409 self.assertTrue(result[1])
410
411 def test_release_save_unacquired(self):
412 # Cannot _release_save an unacquired lock

Callers

nothing calls this directly

Calls 4

assertFalseMethod · 0.80
assertTrueMethod · 0.80
BunchClass · 0.70
lockedMethod · 0.45

Tested by

no test coverage detected