Skip to content

Instantly share code, notes, and snippets.

@jeroenbrouwer
jeroenbrouwer / conftest.py
Last active April 23, 2022 04:38
Setting up django-tenant-schemas with a "fake" pytest tenant
from django.core.management import call_command
from django.db import connection
from tenant_schemas.utils import get_public_schema_name, get_tenant_model
import pytest
TenantModel = get_tenant_model()
def get_or_create_tenant(*, schema_name, migrate=True):
try: