-
Notifications
You must be signed in to change notification settings - Fork 46
/
runtests.py
31 lines (27 loc) · 901 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
#!/usr/bin/env python
import os
import sys
import argparse
import django
from django.conf import settings
from django.test.utils import get_runner
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Run the Django Slick Reporting test suite."
)
parser.add_argument(
"modules",
nargs="*",
metavar="module",
help='Optional path(s) to test modules; e.g. "i18n" or '
'"i18n.tests.TranslationTests.test_lazy_objects".',
)
options = parser.parse_args()
options.modules = [os.path.normpath(labels) for labels in options.modules]
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = test_runner.run_tests(options.modules)
# failures = test_runner.run_tests(["tests"])
sys.exit(bool(failures))