mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-13 18:05:39 +00:00
Introduced --retries flag, made thorough refactoring
- updated sites list - test scripts linting
This commit is contained in:
@@ -2,11 +2,16 @@
|
||||
import pytest
|
||||
import asyncio
|
||||
import logging
|
||||
from maigret.executors import AsyncioSimpleExecutor, AsyncioProgressbarExecutor, \
|
||||
AsyncioProgressbarSemaphoreExecutor, AsyncioProgressbarQueueExecutor
|
||||
from maigret.executors import (
|
||||
AsyncioSimpleExecutor,
|
||||
AsyncioProgressbarExecutor,
|
||||
AsyncioProgressbarSemaphoreExecutor,
|
||||
AsyncioProgressbarQueueExecutor,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def func(n):
|
||||
await asyncio.sleep(0.1 * (n % 3))
|
||||
return n
|
||||
@@ -20,6 +25,7 @@ async def test_simple_asyncio_executor():
|
||||
assert executor.execution_time > 0.2
|
||||
assert executor.execution_time < 0.3
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_asyncio_progressbar_executor():
|
||||
tasks = [(func, [n], {}) for n in range(10)]
|
||||
@@ -64,4 +70,4 @@ async def test_asyncio_progressbar_queue_executor():
|
||||
executor = AsyncioProgressbarQueueExecutor(logger=logger, in_parallel=10)
|
||||
assert await executor.run(tasks) == [0, 3, 6, 9, 1, 4, 7, 2, 5, 8]
|
||||
assert executor.execution_time > 0.2
|
||||
assert executor.execution_time < 0.3
|
||||
assert executor.execution_time < 0.3
|
||||
|
||||
Reference in New Issue
Block a user