mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 16:44:42 +04:00
Switch to using concurrent.futures
This commit is contained in:
parent
231f6013bb
commit
aa50a8cde0
3 changed files with 41 additions and 24 deletions
|
|
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
|||
import sys
|
||||
import time
|
||||
|
||||
import concurrent.futures
|
||||
import mock
|
||||
import pytest
|
||||
import six
|
||||
|
|
@ -180,3 +181,15 @@ def test_xargs_concurrency():
|
|||
# It would take 0.5*5=2.5 seconds ot run all of these in serial, so if it
|
||||
# takes less, they must have run concurrently.
|
||||
assert elapsed < 2.5
|
||||
|
||||
|
||||
def test_thread_mapper_concurrency_uses_threadpoolexecutor_map():
|
||||
with xargs._thread_mapper(10) as thread_map:
|
||||
assert isinstance(
|
||||
thread_map.__self__, concurrent.futures.ThreadPoolExecutor,
|
||||
) is True
|
||||
|
||||
|
||||
def test_thread_mapper_concurrency_uses_regular_map():
|
||||
with xargs._thread_mapper(1) as thread_map:
|
||||
assert thread_map is map
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue