Description
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
doing from django.contrib.auth.forms import UsernameField
It can be fixed by adding 'django.contrib.contenttypes'
to the INSTALLED_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 in INSTALLED_APPS
, as far as I can tell.
Would you be open to such a change?