Remove recorded test migrations before test runs.

Review Request #10575 — Created June 3, 2019 and submitted

Information

Django Evolution
master

Reviewers

Django's list of applied migrations persist between individual unit
tests, which causes state leakage issues, breaking some tests that are
sensitive to the migration history.

This change introduces a new MigrationsTestsMixin class, which handles
removing the list of applied test migrations before running a test. It
makes use of a new unrecord_applied_migrations, which can unrecord
specific migration names or all for an app.

To improve performance, both record_applied_migrations and
unrecord_applied_migrations now operate on the MigrationRecorder's
queryset, rather than using the utility functions, so that we can
manipulate more than one entry in one operation instead of several.

Unit tests pass on all supported versions of Django.

Summary ID
Remove recorded test migrations before test runs.
Django's list of applied migrations persist between individual unit tests, which causes state leakage issues, breaking some tests that are sensitive to the migration history. This change introduces a new `MigrationsTestsMixin` class, which handles removing the list of applied test migrations before running a test. It makes use of a new `unrecord_applied_migrations`, which can unrecord specific migration names or all for an app. To improve performance, both `record_applied_migrations` and `unrecord_applied_migrations` now operate on the `MigrationRecorder`'s queryset, rather than using the utility functions, so that we can manipulate more than one entry in one operation instead of several.
c0262a89b838bd2cb439b1a16733291b754a1791
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (fcda0aa)
Loading...