Add Docker images for test databases and improve testing options.
Review Request #12215 — Created March 28, 2022 and submitted — Latest diff uploaded
This adds a lot of new out-of-the-box functionality for running various
test matrices. There's now a pre-defined list of databases, covering
SQLite, MySQL 5.6/5.7/8, MariaDB, and Postgress 11.8/12/13/14. These are
configured indefault_test_db_settings.py
, which is automatically
loaded, and atests/docker-compose.yaml
is provided in order to fetch
and spin up each of the databases.The
tox
configuration now contains a number of useful environments for
performing tests against various Python/Django/database combinations.
Along with the default Python/Django environments that are run, it
introduces the following new environments:
-
djangos
: Tests all versions of Django against a pre-determined
version of Python. -
pythons
: Tests all versions of Python against a pre-determined
version of Django. -
dbtests-<dbname>
: Tests all versions of Django with the provided
database against a pre-determined version of Python. -
dbtests-<dbname>-<mysql_backend>
: Similar todbtests-<dbname>
,
but accepts a-myisam
or-innodb
suffix to test using that engine
(only supported for MySQL or MariaDB) -
dbtests-newest
: Tests all versions of Django with the newest
testable versions of each type of database. -
dbtests-minmax
: Tests all versions of Django with the oldest and
newest testable versions of each type of database. -
dbtests-all
: Tests all versions of Django with all databases.
During test run, pytest
now provides more relevant database
information. Previously, it would provide the MySQL, Postgres, or SQLite
backend versions, regardless of which tests were being run. Now it
provides them only if testing that backend.
For MySQL/MariaDB, we also show the database storage backend that's
being tested with.
Skipped tests are now shown in pytest output.
This change really does strain tox's configuration options a bit.
Unfortunately, there isn't a way to make generative sections that easily
inherit from a previous one without redundant inheritance rules, and
there isn't a way to list optional test factors (like
myisam
/innodb
), nested factors (like -{mysql{5_6,5_7},postgres{11,12}}
,
or pre-configured but non-default test environments. Some of this may
improve down the road with tox 4.
Tested each of the new environments, letting some run overnight.
Been using most of these for testing with recent changes.