Merge pull request #917 from bearstech/add_extra_fixtures_option

add --extra-fixtures options to avoid python code in tox.ini
This commit is contained in:
Antoine Nguyen
2016-09-16 15:12:31 +02:00
committed by GitHub
2 changed files with 12 additions and 2 deletions
@@ -30,6 +30,10 @@ class Command(BaseCommand):
"--admin-username", default="admin",
help="Username of the initial super administrator."
)
parser.add_argument(
"--extra-fixtures", action="store_true", default=False,
help="Also load some fixtures from the admin application."
)
def handle(self, *args, **options):
"""Command entry point."""
@@ -70,3 +74,7 @@ class Command(BaseCommand):
extension = exts_pool.get_extension(extname)
extension.load_initial_data()
events.raiseEvent("InitialDataLoaded", extname)
if options['extra_fixtures']:
from modoboa.admin import factories
factories.populate_database()
+4 -2
View File
@@ -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