Is it possible to pass command line arguments to Django\'s manage.py
script, specifically for unit tests? i.e. if I do something like
manage.py test
As an alternative way to manage.py test -a do_this
you can use specific settings file
manage.py --settings=project.test_settings test
and define in this file whatever you want.
# test_setting.py
SPECIFIC_OPTION = "test"
# tests.py
from django.conf import settings
...
def setUp(self):
if settings.SPECIFIC_OPTION:
....
If you need really dynamic options, maybe you can use sys.argv
in test_settings.py
, but it is a really dirty hack.