Skip to content

Prioritizing pytests --first flags over Django's "usual" test order breaks mix of TestCase und TransactionTestCase with data migrations #940

Open
@dfn-certling

Description

@dfn-certling

This was introduced in #819. If I have data migrations in my project and two test cases, one TestCase and one TransactionTestCase, prioritizing the first flags over the order introduced in #214 can break the TestCase.

Running tests with --new-first and modifying the TransactionTestCase after the TestCase results in an empty database for the latter. If the project uses data migrations to create default data in the database this breaks the TestCase relying on that data. Running tests with --failed-first does the same if the TransactionTestCase is the last to have failed.

This means for a project using data migrations in this way and having both TestCases and TransactionTestCases the first flags cannot be used reliably currently.

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