pytest-django
pytest-django copied to clipboard
A Django plugin for pytest.
In my project, I have an integration test which uses its own prefilled database. This means that in `conftest.py`, I overwrote this fixture as: ```python @pytest.fixture def django_db_setup(): pass ```...
TLDR of error: Add a migration that removes a field using the django makemigrations flow. Running migrations using django is fine, no errors returned. Running `pipenv run pytest sample/tests.py` returns...
I have a docker-compose based development environment with ``` services: django: postgres: stripe: command: listen --forward-to http://django:8000/stripe/webhook ``` When the user uses stripe to make a payment, an event is...
I am working on a big project which has a lot of migrations and I am bouncing from one branch to another where there will be differences between migrations (eg...
Let's say we've got a following test: ```python # models.py from django.db import models class Post(models.Model): title = models.CharField(max_length=255) class PostHistory(models.Model): post = models.ForeignKey(Post, on_delete=models.CASCADE) def create_post(title): post = Post.objects.create(title=title)...
I'm trying to keep my tests the same but wrap them in pytest which would let me use some nice to haves provided by pytest. When I run via pytest,...
When using the `@pytest.mark.ignore_template_errors` on a test, we could expect the test to return to its original behavior (just like running them without `--fail-on-template-vars`). This would ease the use of...
Ref: https://github.com/pytest-dev/pytest-django/pull/1103#issuecomment-1880164519
I am using `serialized_rollback` to retain some data migration between tests that need a database transaction. Unfortunately, things break when, for example, using the `page` fixture of Playwright or the...