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

Method test_locked_with_2threads

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

Source from the content-addressed store, hash-verified

388 self.assertFalse(lock.locked())
389
390 def test_locked_with_2threads(self):
391 # see gh-134323: check that a rlock which
392 # is acquired in a different thread,
393 # is still locked in the main thread.
394 result = []
395 rlock = self.locktype()
396 self.assertFalse(rlock.locked())
397 def acquire():
398 result.append(rlock.locked())
399 rlock.acquire()
400 result.append(rlock.locked())
401
402 with Bunch(acquire, 1):
403 pass
404 self.assertTrue(rlock.locked())
405 self.assertFalse(result[0])
406 self.assertTrue(result[1])
407
408 def test_release_save_unacquired(self):
409 # 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