forked from Niklas9/django-unixdatetimefield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
executable file
·52 lines (44 loc) · 1.46 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
#!/usr/bin/env python
import optparse
import sys
import django.conf as conf
if not conf.settings.configured:
conf.settings.configure(
DATABASE_ENGINE='django.db.backends.sqlite3',
DATABASE_NAME='django_unixdatetimefield_test',
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'django_unixdatetimefield_test',
}
},
INSTALLED_APPS=[
'django.contrib.contenttypes',
'django_unixdatetimefield',
'django_unixdatetimefield.tests',
],
MIDDLEWARE_CLASSES = tuple(),
ROOT_URLCONF='',
DEBUG=False,
)
# NOTE(niklas9):
# * need to have import django_nose after settings has been configured.. I don't
# like this.. but as it seems to be required by django_nose..
import django_nose
def runtests(*test_args, **kwargs):
if not test_args: test_args = ['django_unixdatetimefield']
import django
try:
django.setup()
except AttributeError:
pass
kwargs.setdefault('interactive', False)
test_runner = django_nose.NoseTestSuiteRunner(**kwargs)
failures = test_runner.run_tests(test_args)
sys.exit(failures)
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option('--verbosity', dest='verbosity', action='store',
default=1, type=int)
(options, args) = parser.parse_args()
runtests(*args, **options.__dict__)