Skip to content

🔙 Enable serialized_rollback in TestCases #836

Closed
@coiax

Description

@coiax

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions