forked from malero/django-orml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
39 lines (34 loc) · 1.13 KB
/
run_tests.py
File metadata and controls
39 lines (34 loc) · 1.13 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
import dj_database_url
import django, sys
import os
from django.conf import settings
DIRNAME = os.path.dirname(__file__)
DATABASE_URL = os.environ.get('DATABSE_URL', None)
if DATABASE_URL is None:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(DIRNAME, 'database.db'),
}
}
else:
DATABASES = {'default': dj_database_url.config(default=DATABASE_URL)}
settings.configure(DEBUG=True,
DATABASES=DATABASES,
INSTALLED_APPS=('django.contrib.auth',
'django.contrib.contenttypes',
'orml',
'orml.tests',
))
try:
# Django <= 1.8
from django.test.simple import DjangoTestSuiteRunner
test_runner = DjangoTestSuiteRunner(verbosity=1)
except ImportError:
# Django >= 1.8
django.setup()
from django.test.runner import DiscoverRunner
test_runner = DiscoverRunner(verbosity=1)
failures = test_runner.run_tests(['orml'])
if failures:
sys.exit(failures)