index
:
tcl.git
8_5_with_8_6_regexp
Coverity_CID_1251203
ISC_peephole
activestate_nre_excised_variant_1_roll_forward
activestate_nre_excised_variant_2_subtracted
adjust_fix
ajuba_ajuba2_2_0_synthetic
ajuba_ajuba2_2_1_base_synthetic
aku_mem_debug_allow_regular
aku_review
aku_tip_280_cl_perf_trial
aku_tkt_6141c15186
amg_array_enum_c_api
amg_string_insert
androwish
apn_hash_opt
array_search_unset
aspect_async_pipe
aspect_bug_391bc0fd2c
aspect_lreplace_cleanup
aspect_lreplace_fix
aspect_lreplace_refix
aspect_shimmer_singleton_lists
aspect_string_match
aspect_tip288
avl_strcat_fix
avl_tip_282
backout_memaccounting
bch_coverity
better_deprecation
better_deprecation_85
bg_tip_282
bsg_0d_radix_prefix
bug3036566
bug_010f4162ef
bug_0520d17284
bug_05489ce335
bug_0b874c344d
bug_0b874c344d_ak_info_frame_coro
bug_0b8c387cf7
bug_0c043a175
bug_0e4d88b650
bug_0f42ff7871
bug_1189293
bug_1224888
bug_12b0997ce7
bug_13d3af3ad5
bug_13d3af3ad5_fork
bug_1493a43044
bug_1536227
bug_16828b3744
bug_1712098
bug_1758a0b603
bug_1a25fdfec6
bug_1b0266d8bb
bug_2152292
bug_219866c1e9
bug_2413550
bug_2502002
bug_25842c161f
bug_272e866f1e
import imp
from
test
.
test_support
import
TestFailed
def
verify_lock_state
(
expected
):
if
imp
.
lock_held
() !=
expected
:
raise
TestFailed
(
"expected imp.lock_held() to be %r"
%
expected
)
def
testLock
():
LOOPS
=
50
# The import lock may already be held, e.g. if the test suite is run
# via "import test.autotest".
lock_held_at_start
=
imp
.
lock_held
()
verify_lock_state
(
lock_held_at_start
)
for
i
in
range
(
LOOPS
):
imp
.
acquire_lock
()
verify_lock_state
(
True
)
for
i
in
range
(
LOOPS
):
imp
.
release_lock
()
# The original state should be restored now.
verify_lock_state
(
lock_held_at_start
)
if not
lock_held_at_start
:
try
:
imp
.
release_lock
()
except
RuntimeError
:
pass
else
:
raise
TestFailed
(
"release_lock() without lock should raise "
"RuntimeError"
)
def
test_main
():
testLock
()
if
__name__
==
"__main__"
:
test_main
()