#23640: StaticLiveServerTestCase does not properly respect data migrations
-------------------------------------+-------------------------------------
Reporter: eldamir | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: data migration, | Triage Stage:
functional tests | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by eldamir):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> When data migrations exists for a project, it is expected that each test
> case has these migrations run before running the test.
> That is indeed the case for django.tests.TestCase (unit tests), but it is
> NOT working for
> django.contrib.staticfiles.testing.StaticLiveServerTestCase (functional
> tests).
>
> Migrations seem to be run for each class, e.g.
> MyTestCase(StaticLiveServerTestCase), but not for the methods of this
> class. That is, if MyTestCase has 3 methods with tests, the migrations
> are only loaded for the first one, and then the database is wiped, and
> the objects from the data migration is no longer present for the next two
> methods.
>
> A minimal reproduction of this issue - along with a guide to the issue
> and which files to look at - can be found here:
> https://github.com/eldamir/django_migration_bug
New description:
When data migrations exist for a project, it is expected that each test
case has these migrations run before running the test.
That is indeed the case for django.tests.TestCase (unit tests), but it is
NOT working for
django.contrib.staticfiles.testing.StaticLiveServerTestCase (functional
tests).
Migrations seem to be run for each class, e.g.
MyTestCase(StaticLiveServerTestCase), but not for the methods of this
class. That is, if MyTestCase has 3 methods with tests, the migrations are
only loaded for the first one, and then the database is wiped, and the
objects from the data migration are no longer present for the next two
methods.
A minimal reproduction of this issue - along with a guide to the issue and
which files to look at - can be found here:
https://github.com/eldamir/django_migration_bug
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23640#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.37be5ebab0f3cbb0a2ae5e010cfaaefe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.