devind-team / graphene-django-filter

Advanced filters for Graphene
MIT License
19 stars 7 forks source link

Pytest run fails due to db query at import time #80

Open IBA20 opened 8 months ago

IBA20 commented 8 months ago

The below code in conf.py queries database at import time:

def get_fixed_settings() -> Dict[str, bool]:
    """Return fixed settings."""
    is_postgresql = connection.vendor == 'postgresql'
    has_trigram_extension = False
    if is_postgresql:
        with connection.cursor() as cursor:
            cursor.execute("SELECT COUNT(*) FROM pg_available_extensions WHERE name='pg_trgm'")

For this reason pytest run fails with error: RuntimeError: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db" fixtures to enable it.

Any ideas what to do with this?