mirror of
https://github.com/ivan-usov-org/bec.git
synced 2025-04-22 02:20:02 +02:00
13 lines
640 B
Python
13 lines
640 B
Python
from bec_lib.core.singleton_threadpool import SingletonThreadpool
|
|
|
|
|
|
def test_singleton_threadpool():
|
|
threadpool = SingletonThreadpool()
|
|
assert threadpool.executor._max_workers == SingletonThreadpool.DEFAULT_MAX_WORKER
|
|
executor_id = id(threadpool.executor)
|
|
new_threadpool = SingletonThreadpool()
|
|
assert threadpool.executor._max_workers == SingletonThreadpool.DEFAULT_MAX_WORKER
|
|
assert executor_id == id(new_threadpool.executor)
|
|
new_threadpool = SingletonThreadpool(max_workers=SingletonThreadpool.DEFAULT_MAX_WORKER + 10)
|
|
assert threadpool.executor._max_workers == SingletonThreadpool.DEFAULT_MAX_WORKER + 10
|