<NME> tox.ini
<BEF> [tox]
envlist = py{37,38,39}

[testenv]
changedir = test_project
commands =
    python ../tests.py
    coverage run --source modoboa manage.py test modoboa.core modoboa.lib modoboa.admin modoboa.limits modoboa.transport modoboa.relaydomains modoboa.dnstools modoboa.ldapsync

    coverage report --show-missing
deps =
    -r{toxinidir}/requirements.txt
    -r{toxinidir}/test-requirements.txt

[testenv:serve]
changedir=test_project
commands =
    python manage.py migrate --no-input
    python manage.py load_initial_data
    python -c "import django; django.setup(); from modoboa.admin.factories import populate_database; populate_database()"
    python manage.py runserver
setenv =
    DJANGO_SETTINGS_MODULE=test_project.settings
    rm -f modoboa_test.db
    python manage.py migrate --no-input
    python manage.py load_initial_data --extra-fixtures
    python manage.py runserver
setenv =
    DJANGO_SETTINGS_MODULE=test_project.settings
    DB=SQLITE
    DEBUG=1

[testenv:doc]
changedir = doc
deps =
    sphinx
    Pygments
whitelist_externals =
    rm
commands =
    rm -Rf {envtmpdir}/doctrees {envtmpdir}/html
    sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

<MSG> add --extra-fixtures options to avoid python code in tox.ini

<DFF> @@ -14,10 +14,12 @@ setenv =
 
 [testenv:serve]
 changedir=test_project
+whitelist_externals =
+    rm
 commands =
+    rm -f modoboa_test.db
     python manage.py migrate --no-input
-    python manage.py load_initial_data
-    python -c "import django; django.setup(); from modoboa.admin.factories import populate_database; populate_database()"
+    python manage.py load_initial_data --extra-fixtures
     python manage.py runserver
 setenv =
     DJANGO_SETTINGS_MODULE=test_project.settings

add --extra-fixtures options to avoid python code in tox.ini