#26822: New migrations not applied on clone databases (sqlite) when using
--parallel and --keepdb option
-------------------------------+--------------------
Reporter: romgar | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I have noticed an issue when using `--parallel` and `--keepdb` option in
test environment.
The first time I run my tests with both options, everything is fine.
If I run again my tests after having added a new migration, this migration
is not applied to the clone databases, which makes the tests using these
cloned databases fail.
After looking a bit on `test.runner.setup_databases` function, I noticed
that the first database is created in `connection.creation.create_test_db`
(with correct migrations applied to it), and then the cloned database
creation happens in `connection.creation.clone_test_db`.
On sqlite, the function responsible of database cloning is
`db.backend.sqlite3.creation._clone_test_db`, and in case of `keepdb`
option, we don't touch the cloned databases:
{{{
if keepdb:
return
}}}
But then, the migrations applied to the default database are not present
in cloned ones.
I have noticed this behaviour on sqlite, I have not checked what happened
on other databases.
If we remove this `keepdb` condition, that will work but slow down the
test execution. A more interesting approach would probably be to apply
migrations to all databases, not just the default one.
Any thoughts about that? Or maybe I have missed some details?
--
Ticket URL: <https://code.djangoproject.com/ticket/26822>
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/049.4ff31a0a695025632973c56d9eeae897%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.