A python library which produces pytest fixtures which let you test against external resource (Postgres, Mongo, Redshift…) dependent code, by orchestrating running real instances of those services.

from pytest_mock_resources import create_postgres_fixture
from models import ModelBase

pg = create_postgres_fixture(ModelBase, session=True)

def test_view_function_empty_db(pg):
  response = view_function(pg)
  assert response == ...