forked from appsembler/xblock-video
-
Notifications
You must be signed in to change notification settings - Fork 17
/
run_tests.py
executable file
·46 lines (37 loc) · 1.39 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Run tests for the VideoXBlock.
This script is required to run our selenium tests inside the xblock-sdk workbench
because the workbench SDK's settings file is not inside any python module.
"""
import os
import sys
import logging
logging_level_overrides = {
'workbench.views': logging.ERROR,
'django.db.backends.schema': logging.INFO,
'django.request': logging.ERROR,
'workbench.runtime': logging.ERROR,
}
if __name__ == "__main__":
# Use the workbench settings file:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "workbench.settings")
# Configure a range of ports in case the default port of 8081 is in use
os.environ.setdefault("DJANGO_LIVE_TEST_SERVER_ADDRESS", "localhost:8081-8099")
try:
os.mkdir('var')
except OSError:
# May already exist.
pass
from django.conf import settings
settings.INSTALLED_APPS += ("video_xblock", )
for noisy_logger, log_level in logging_level_overrides.items():
logging.getLogger(noisy_logger).setLevel(log_level)
from django.core.management import execute_from_command_line
args = sys.argv[1:]
paths = [arg for arg in args if arg[0] != '-']
if not paths:
paths = ["video_xblock/tests/acceptance"]
options = [arg for arg in args if arg not in paths]
execute_from_command_line([sys.argv[0], "test"] + paths + options)