File: test_thread__boundedsem.py

package info (click to toggle)
python-eventlet 0.26.1-7%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,916 kB
  • sloc: python: 24,898; makefile: 98
file content (19 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Test that BoundedSemaphore with a very high bound is as good as unbounded one"""
from eventlet import semaphore
from eventlet.green import thread


def allocate_lock():
    return semaphore.Semaphore(1, 9999)

original_allocate_lock = thread.allocate_lock
thread.allocate_lock = allocate_lock
original_LockType = thread.LockType
thread.LockType = semaphore.CappedSemaphore

try:
    import os.path
    execfile(os.path.join(os.path.dirname(__file__), 'test_thread.py'))
finally:
    thread.allocate_lock = original_allocate_lock
    thread.LockType = original_LockType