-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathruntests.py
executable file
·40 lines (28 loc) · 958 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
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
import os
import shutil
import sys
import warnings
from django.core.management import execute_from_command_line
from tests.settings import MEDIA_ROOT, STATIC_ROOT
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
def runtests():
# Don't ignore DeprecationWarnings
only_wagtailmedia = r"^wagtailmedia(\.|$)"
warnings.filterwarnings(
"default", category=DeprecationWarning, module=only_wagtailmedia
)
warnings.filterwarnings(
"default", category=PendingDeprecationWarning, module=only_wagtailmedia
)
args = sys.argv[1:]
argv = sys.argv[:1] + ["test"] + args
shutil.rmtree(STATIC_ROOT, ignore_errors=True)
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
try:
execute_from_command_line(argv)
finally:
shutil.rmtree(STATIC_ROOT, ignore_errors=True)
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
if __name__ == "__main__":
runtests()