-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathruntests.py
49 lines (39 loc) · 1.19 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2013 Raphaël Barrois
# This code is distributed under the two-clause BSD license.
from __future__ import unicode_literals
import sys
# Generic Django imports
import django
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'django_factory_boy',
],
)
# "configuration required" django imports
if django.VERSION >= (1, 7, 0):
django.setup()
if django.VERSION <= (1, 8, 0):
from django.test.simple import DjangoTestSuiteRunner
else:
from django.test.runner import DiscoverRunner as DjangoTestSuiteRunner
def runtests(*test_args):
if not test_args:
test_args = ('django_factory_boy',)
runner = DjangoTestSuiteRunner(failfast=False)
failures = runner.run_tests(test_args)
sys.exit(failures)
if __name__ == '__main__':
runtests(*sys.argv[1:])