Skip to content

SimpleTestCase triggers database migrations #1049

Closed
@flaeppe

Description

The default implementation of SimpleTestCase disables database queries per default, which is why I'm thinking that migrating the database could conditionally happen depending on the value of SimpleTestCase.databases?

SimpleTestCase disallows database queries by default. This helps to avoid executing write queries which will affect other tests since each SimpleTestCase test isn’t run in a transaction. If you aren’t concerned about this problem, you can disable this behavior by setting the databases class attribute to 'all' on your test class.

Ref: https://docs.djangoproject.com/en/4.1/topics/testing/tools/#django.test.SimpleTestCase.databases

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