-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathruntests.py
More file actions
executable file
·35 lines (24 loc) · 935 Bytes
/
runtests.py
File metadata and controls
executable file
·35 lines (24 loc) · 935 Bytes
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
#!/usr/bin/env python
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
# Make sure the app is (at least temporarily) on the import path.
APP_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, APP_DIR)
def run_tests():
# Making Django run this way is a two-step process. First, call
# settings.configure() to give Django settings to work with:
from django.conf import settings
# Then, call django.setup() to initialize the application registry
# and other bits:
import django
django.setup()
# Now we instantiate a test runner...
from django.test.utils import get_runner
TestRunner = get_runner(settings)
# And then we run tests and return the results.
test_runner = TestRunner(verbosity=2, interactive=True)
failures = test_runner.run_tests(["tests"])
sys.exit(failures)
if __name__ == "__main__":
run_tests()