Introduced --retries flag, made thorough refactoring

- updated sites list
- test scripts linting
This commit is contained in:
Soxoj
2021-05-01 23:51:48 +03:00
parent 7fd4a2c516
commit 5ee91f6659
18 changed files with 6182 additions and 4943 deletions
+9 -3
View File
@@ -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