hypothesis.extra.django.TestCase vs. Django INSTALLED_APPS #3716
Labels
enhancement
it's not broken, but we want it to be better
interop
how to play nicely with other packages
Hello, I'm trying out Hypothesis 6.82.2 on my Django 4.2 project.
Importing
hypothesis.extra.django.TestCase
fails with"RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS."
The error is triggered by
hypothesis/extra/django/_fields.py
doingfrom django.contrib.auth.forms import UsernameField
It can be fixed by adding
'django.contrib.contenttypes'
to theINSTALLED_APPS
setting.However, I would like to use Hypothesis without modifying my INSTALLED_APPS setting.
Ideally, Hypothesis should use UsernameField when it is available, and not register strategies for it when it is not available. UsernameField is available when
'django.contrib.contenttypes'
and'django.contrib.auth'
are inINSTALLED_APPS
, as far as I can tell.Would you be open to such a change?
The text was updated successfully, but these errors were encountered: