The output when the tests fail after the migration:
{{{
Running migrations:
Applying mymodel.0007_auto_20220503_1433... OK
Using existing clone for alias 'default' ('myproject_test')...
Cache table 'rhymedict_cache' already exists.
Using existing clone for alias 'default' ('myproject_test')...
Using existing clone for alias 'default' ('myproject_test')...
Using existing clone for alias 'default' ('myproject_test')...
...
======================================================================
ERROR: test_mytest
(myproject.myapp.test.MyTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
...
psycopg2.errors.UndefinedColumn: column "field2" of relation
"myapp_mymodel" does not exist
LINE 1: ... "field1", "field2") VA...
...
django.db.utils.ProgrammingError: column "field2" of relation
"myapp_mymodel" does not exist
LINE 1: ... "field1", "field2") VA...
}}}
After I drop the myproject_test_1... myproject_test_4 db's manually and
run the command again:
{{{
Using existing test database for alias 'default' ('myproject_test')...
Operations to perform:
Synchronize unmigrated apps: analytical, compressor, cookielaw,
corsheaders, crispy_forms, debug_toolbar, dj_rest_auth, django_hosts,
genlocale, import_export, massadmin, menu, messages, rest_framework,
rosetta, sitemaps, static_sitemaps, staticfiles
Apply all migrations: myapp1, myapp2
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
No migrations to apply.
Cache table 'myproject_cache' already exists.
Using existing clone for alias 'default' ('myproject_test')...
Got an error creating the test database: source database "myproject_test"
is being accessed by other users
DETAIL: There is 1 other session using the database.
}}}
Without the --parallel option, the test command runs just fine.
My Django version is 2.2.12
--
Ticket URL: <https://code.djangoproject.com/ticket/33677>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
New description:
To run my tests, I run
{{{
./manage.py test --keepdb --parallel -v 2
}}}
I use PostgreSQL 11 db on macOS Catalina 10.15.7 (19H2).
The problem is that if I have any change in the db (eg. a field added),
the parallel db's don't get migrated and thus the tests fail.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/33677#comment:1>
* status: new => closed
* type: Uncategorized => Bug
* resolution: => invalid
Comment:
Thanks for the report, however Django 2.2 is not supported anymore. Can
you reproduce this issue on Django 4.0 or the current development branch?
We made many improvements in this area.
--
Ticket URL: <https://code.djangoproject.com/ticket/33677#comment:2>