-
Notifications
You must be signed in to change notification settings - Fork 12
/
runtests.py
executable file
·71 lines (64 loc) · 2.32 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
import sys
import django
from django.conf import settings
from django.core.management import execute_from_command_line
import os
import shutil
if not settings.configured:
settings.configure(
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.sessions',
'django_nose',
'django_google_adwords',
],
# Django replaces this, but it still wants it. *shrugs*
DATABASE_ENGINE='django.db.backends.sqlite3',
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'loggers': {
'django.db.backends.schema': {
'propagate': False,
'level': 'WARNING',
},
'django_google_adwords.models.locker': {
'propagate': False,
'level': 'WARNING',
},
}
},
MEDIA_ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__), 'django_google_adwords', 'tests', 'media')),
GOOGLEADWORDS_REPORT_FILE_ROOT='dga-test-reports',
MIDDLEWARE_CLASSES={},
TEST_RUNNER='django_nose.NoseTestSuiteRunner',
NOSE_ARGS=['--logging-clear-handlers',
# Coverage - turn on with NOSE_WITH_COVERAGE=1
'--cover-html',
'--cover-package=django_google_adwords',
'--cover-erase',
'--with-fixture-bundling',
# Nose Progressive
'--with-progressive',
]
)
def runtests():
test_args = sys.argv[1:] if len(sys.argv[1:]) > 0 else ['django_google_adwords.tests']
test_args.append('--with-fixture-bundling')
argv = sys.argv[:1] + ['test'] + test_args
execute_from_command_line(argv)
# Cleanup any files created, don't do in tear down in case MEDIA_ROOT is misconfigured
path = os.path.join(settings.MEDIA_ROOT, settings.GOOGLEADWORDS_REPORT_FILE_ROOT)
if os.path.exists(path):
shutil.rmtree(path)
if __name__ == '__main__':
runtests()