forked from koleror/django-admin-views
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntests.py
More file actions
executable file
·58 lines (50 loc) · 1.74 KB
/
runtests.py
File metadata and controls
executable file
·58 lines (50 loc) · 1.74 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
import os
import sys
from os.path import dirname, abspath
from django.conf import settings
TEST_ROOT = os.path.dirname(__file__)
PROJECT_ROOT = os.path.join(TEST_ROOT, '../../example_project/example_project/')
if not settings.configured:
settings.configure(
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'foo.db',
}
},
SITE_ID = 1,
COVERAGE_MODULE_EXCLUDES = [
'tests$', 'settings$', 'urls$',
'common.views.test', '__init__', 'django',
],
ROOT_URLCONF = 'example_project.urls',
WSGI_APPLICATION = 'example_project.wsgi.application',
TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates/"),),
STATIC_URL='/static/',
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_coverage',
'admin_views',
'example_project.example_app',
'django.contrib.admin',
],
)
from django.test.simple import DjangoTestSuiteRunner
from django_coverage.coverage_runner import CoverageRunner
def runtests(*test_args):
if not test_args:
test_args = ['admin_views']
parent = dirname(abspath(__file__))
example_project = os.path.join(parent, 'example_project')
sys.path.insert(0, example_project)
runner = CoverageRunner()
failures = runner.run_tests(test_args, verbosity=1, interactive=True)
sys.exit(failures)
if __name__ == '__main__':
runtests(*sys.argv[1:])