• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sivakov512 / asyncpg-engine / 8545282536

03 Apr 2024 08:44PM UTC coverage: 46.25%. Remained the same
8545282536

push

github

sivakov512
Make linter happy

0 of 3 new or added lines in 1 file covered. (0.0%)

37 of 80 relevant lines covered (46.25%)

1.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.85
/asyncpg_engine/pytest_plugin.py
1
import typing
×
2

3
import pytest
×
4
import pytest_asyncio
×
5
from asyncpg import Connection
×
6

7
from asyncpg_engine import Engine
×
8

9

10
def pytest_configure(config: typing.Any) -> None:
×
11
    config.addinivalue_line("markers", "asyncpg_engine: configure asyncpg-engine plugin behaviour.")
3✔
12

13

NEW
14
@pytest.fixture
×
15
def asyncpg_engine_cls() -> typing.Type[Engine]:
×
16
    return Engine
3✔
17

18

NEW
19
@pytest_asyncio.fixture
×
20
async def db(
×
21
    request: pytest.FixtureRequest, asyncpg_engine_cls: typing.Type[Engine], postgres_url: str
22
) -> typing.AsyncGenerator[Engine, None]:
23
    plugin_config = request.node.get_closest_marker("asyncpg_engine")
3✔
24

25
    transactional = getattr(plugin_config, "kwargs", {}).get("transactional", True)
3✔
26

27
    _db = await asyncpg_engine_cls.create(url=postgres_url, use_single_connection=transactional)
3✔
28

29
    con: Connection = await _db.acquire()  # type: ignore
3✔
30
    tr = con.transaction()
3✔
31
    await tr.start()
3✔
32

33
    yield _db
3✔
34

35
    await tr.rollback()
3✔
36
    await _db.release(con, force=transactional)
3✔
37
    await _db.close()
3✔
38

39

NEW
40
@pytest_asyncio.fixture
×
41
async def con(db: Engine) -> typing.AsyncGenerator[Connection, None]:
×
42
    async with db.acquire() as _con:
3✔
43
        yield _con
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc