Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hypothesis.extra.django.TestCase vs. Django INSTALLED_APPS #3716

Open
erikrw opened this issue Aug 12, 2023 · 0 comments
Open

hypothesis.extra.django.TestCase vs. Django INSTALLED_APPS #3716

erikrw opened this issue Aug 12, 2023 · 0 comments
Labels
enhancement it's not broken, but we want it to be better interop how to play nicely with other packages

Comments

@erikrw
Copy link

erikrw commented Aug 12, 2023

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?

@Zac-HD Zac-HD added enhancement it's not broken, but we want it to be better interop how to play nicely with other packages labels Aug 12, 2023
@Zac-HD Zac-HD mentioned this issue May 18, 2024
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement it's not broken, but we want it to be better interop how to play nicely with other packages
Projects
None yet
Development

No branches or pull requests

2 participants