0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-24 01:57:32 +01:00
wagtail/runtests.py

40 lines
1.0 KiB
Python
Raw Normal View History

#!/usr/bin/env python
2014-02-17 12:03:41 +01:00
import sys
import os
import shutil
import warnings
from django.core.management import execute_from_command_line
os.environ['DJANGO_SETTINGS_MODULE'] = 'wagtail.tests.settings'
def runtests():
# Don't ignore DeprecationWarnings
warnings.simplefilter('default', DeprecationWarning)
warnings.simplefilter('default', PendingDeprecationWarning)
args = sys.argv[1:]
if '--postgres' in args:
os.environ['DATABASE_ENGINE'] = 'django.db.backends.postgresql_psycopg2'
args.remove('--postgres')
if '--elasticsearch' in args:
os.environ.setdefault('ELASTICSEARCH_URL', 'http://localhost:9200')
args.remove('--elasticsearch')
argv = sys.argv[:1] + ['test'] + args
try:
execute_from_command_line(argv)
finally:
from wagtail.tests.settings import STATIC_ROOT, MEDIA_ROOT
shutil.rmtree(STATIC_ROOT, ignore_errors=True)
2014-02-23 15:57:33 +01:00
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
if __name__ == '__main__':
runtests()