Skip to content

🔙 Enable serialized_rollback in TestCases #836

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

Closed
coiax opened this issue Apr 21, 2020 · 2 comments
Closed

🔙 Enable serialized_rollback in TestCases #836

coiax opened this issue Apr 21, 2020 · 2 comments

Comments

@coiax
Copy link

coiax commented Apr 21, 2020

https://docs.djangoproject.com/en/2.2/topics/testing/overview/#rollback-emulation

When using the transactional_db or live_server fixtures, during cleanup, Django will truncate the tables.
If you have data migrations that provide initial data, that initial data will be wiped as well.

By using the serialized_rollback attribute in TestCases, it should enable you to load the initial data at the start of every test, but using pytest-django means you can't edit the TestCase classes directly.


I propose a mark, django_serialized_rollback (?), which if present, will enable the serialized_rollback attribute, thus enabling this behavior.

Wanted to open an issue first to check that was the right way of going about this, before actually writing the tests and code for it.

@luzfcb
Copy link

luzfcb commented Apr 21, 2020

@coiax feel free to continue the work of #721

@coiax
Copy link
Author

coiax commented May 7, 2020

Closing, since this is a duplicate of #329

@coiax coiax closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants