forked from bashu/wagtail-embedvideos
-
Notifications
You must be signed in to change notification settings - Fork 1
/
runtests.py
executable file
·38 lines (27 loc) · 1.01 KB
/
runtests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import os
import shutil
import sys
import warnings
from django.core.management import execute_from_command_line
os.environ['DJANGO_SETTINGS_MODULE'] = 'wagtail_embed_videos.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)
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
if __name__ == '__main__':
runtests()