Skip to content
Discussion options

You must be logged in to vote

It works as expected in 0.22.0

import ormar
import pytest

from tests.lifespan import init_tests
from tests.settings import create_config

base_ormar_config = create_config()


class Jimmy(ormar.Model):
    ormar_config = base_ormar_config.copy(tablename="jimmies")
    name = ormar.String(primary_key=True, max_length=42)


create_test_database = init_tests(base_ormar_config)


@pytest.fixture(scope="session")
def anyio_backend():
    return "asyncio"


@pytest.mark.anyio
@pytest.fixture(scope="function", autouse=True)
async def db_session():
    async with base_ormar_config.database:
        async with base_ormar_config.database.transaction(force_rollback=True):
            yield


@pytest.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@cmflynn
Comment options

@SepehrBazyar
Comment options

@cmflynn
Comment options

@collerek
Comment options

Answer selected by cmflynn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants