Skip to content

Commit 8186b8d

Browse files
committed
Merge branch 'HH-166889'
2 parents 1f9f3b8 + 6921841 commit 8186b8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+5217
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
# py-nab
2+
3+
## ararat - утилиты необходимые для обычного приложения
4+
5+
## almatest - утилиты и pytest-плагин для юнит-тестов
6+
7+
## frontik-fastapi - bridge для использования fastapi во фронтике. Экспериментальный код, не использовать в продакшене.

almatest/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Utils for unit tests
2+

almatest/almatest/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import asyncio
2+
3+
import pytest
4+
import pytest_asyncio
5+
6+
7+
@pytest.fixture(scope="session")
8+
def event_loop():
9+
loop = asyncio.get_event_loop()
10+
yield loop
11+
loop.close()
12+
13+
14+
pytest_asyncio.plugin.event_loop = event_loop

almatest/almatest/containers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import asyncio
2+
from concurrent.futures import ThreadPoolExecutor
3+
from typing import TypeVar
4+
5+
from testcontainers.core.container import DockerContainer
6+
7+
C = TypeVar("C", bound=DockerContainer)
8+
9+
10+
async def start_container(container: C) -> C:
11+
def _start_container():
12+
container.start()
13+
return container
14+
15+
with ThreadPoolExecutor() as pool:
16+
return await asyncio.get_running_loop().run_in_executor(pool, _start_container)

0 commit comments

Comments
 (0)