Skip to content

Instantly share code, notes, and snippets.

View danielTobon43's full-sized avatar
🤠
Working

Daniel danielTobon43

🤠
Working
View GitHub Profile
@kissgyorgy
kissgyorgy / sqlalchemy_conftest.py
Last active March 5, 2024 23:05
Python: py.test fixture for SQLAlchemy test in a transaction, create tables only once!
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from myapp.models import BaseModel
import pytest
@pytest.fixture(scope="session")
def engine():
return create_engine("postgresql://localhost/test_database")