forked from django-hijack/django-hijack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
executable file
·40 lines (26 loc) · 1001 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
"""
This script is a trick to setup a fake Django environment, since this reusable
app will be developed and tested outside any specifiv Django project.
Via ``settings.configure`` you will be able to set all necessary settings
for your app and run the tests as if you were calling ``./manage.py test``.
"""
import sys
from django.conf import settings
from hijack.tests import test_settings
if not settings.configured:
settings.configure(**test_settings.__dict__)
#from django_coverage.coverage_runner import CoverageRunner
from django_nose import NoseTestSuiteRunner
class NoseCoverageTestRunner(NoseTestSuiteRunner):
"""Custom test runner that uses nose and coverage"""
pass
def runtests(*test_args):
import django
if django.VERSION >= (1, 7):
django.setup()
failures = NoseCoverageTestRunner(verbosity=2, interactive=True).run_tests(
test_args)
sys.exit(failures)
if __name__ == '__main__':
runtests(*sys.argv[1:])