Install tox.
Run a supported version of MySQL or MariaDB. This is easiest with the official Docker images. For example:
docker run --detach --name mariadb -e MYSQL_ROOT_PASSWORD=hunter2 --publish 3306:3306 mariadb:10.8
Run the tests by passing environment variables with your connection parameters. For the above Docker command:
DB_HOST=127.0.0.1 DB_USER=root DB_PASSWORD='hunter2' tox -e py313-django51
tox environments are split per Python and Django version.
You can run a subset of tests by passing them after
--
like:DB_HOST=127.0.0.1 DB_USER=root DB_PASSWORD='hunter2' tox -e py313-django51 -- tests/testapp/test_cache.py
You can also pass other pytest arguments after the
--
.