-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.py
31 lines (29 loc) · 1.17 KB
/
run_tests.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
#!/usr/bin/env python
import os
import sys
import tempfile
import django
from django.conf import settings
from django.test.utils import get_runner
if __name__ == '__main__':
os.environ['DJANGO_SETTINGS_MODULE'] = 'config.settings.unit_tests'
os.environ['SECRET_KEY'] = '1234567890'
os.environ['GRADSCHOOL_ETD_ADDRESS'] = 'random@example.org'
os.environ['OWNER_ID'] = 'OWNER_ID'
os.environ['EMBARGOED_DISPLAY_IDENTITY'] = 'EMBARGO'
os.environ['PUBLIC_DISPLAY_IDENTITY'] = 'PUBLIC'
os.environ['BDR_POST_IDENTITY'] = 'BDR_POST_IDENTITY'
os.environ['BDR_AUTHORIZATION_CODE'] = 'BDR_AUTHORIZATION_CODE'
os.environ['EMAIL_HOST'] = 'EMAIL_HOST'
os.environ['SERVER_EMAIL'] = 'SERVER_EMAIL'
os.environ['SERVER_ROOT'] = 'http://localhost/'
os.environ['API_URL'] = 'http://localhost/api/'
os.environ['ALLOWED_HOST'] = 'localhost'
with tempfile.TemporaryDirectory() as tmp:
os.environ['MEDIA_ROOT'] = os.path.join(tmp, 'media')
os.environ['LOG_DIR'] = tmp
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = test_runner.run_tests(['tests'])
sys.exit(bool(failures))