pytest-dev / pytest-dev/pytest-django
How to persisit data inside the database after tests run
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
Is there any way to persist data inside a (postgres) database after the tests run.
I've run through https://pytest-django.readthedocs.io/en/latest/database.html several times and none of the solutions provided seem to help.
Marking this test with @pytest.mark.django_db doesn't help, using the django_db_blocker fixture and calling .unblock() as the first line of the test doesn't work, the --reuse-db flag => in the database not being deleted but it remains empty once the tests run.
I see no object while the tests are running, so it seems to me like transactions aren't be committed, but I can't figure out how to change that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or failing test is named. Start by reproducing the behavior with the django_db marker, django_db_blocker fixture, and --reuse-db flag, then trace the database setup and transaction handling; done would require a maintainer-confirmed explanation and a documented fix or regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, postgresql, python
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100