forked from mback2k/django-celery-model
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathruntests.py
30 lines (22 loc) · 871 Bytes
/
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
#!/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'] = 'djcelery_model.tests.settings'
def runtests():
# Don't ignore DeprecationWarnings
only_djcelery_model = r'^djcelery_model(\.|$)'
warnings.filterwarnings('default', category=DeprecationWarning, module=only_djcelery_model)
warnings.filterwarnings('default', category=PendingDeprecationWarning, module=only_djcelery_model)
args = sys.argv[1:]
argv = sys.argv[:1] + ['test'] + args
try:
execute_from_command_line(argv)
finally:
from djcelery_model.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()