pytest-django icon indicating copy to clipboard operation
pytest-django copied to clipboard

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

Open dfn-certling opened this issue 4 years ago • 0 comments
trafficstars

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.

dfn-certling avatar Jul 13 '21 15:07 dfn-certling