Skip to content

Commit f9679aa

Browse files
committed
Merge pull request #222 from pzinovkin/master
Fix for error 'Settings' object has no attribute 'DATABASE_ENGINE' (#208)
2 parents 0890d36 + f9e17db commit f9679aa

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

debug_toolbar/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def sql_explain(request):
8282
params = simplejson.loads(params)
8383
cursor = connections[alias].cursor()
8484

85-
if settings.DATABASE_ENGINE == "sqlite3":
85+
conn = connections[alias].connection
86+
engine = conn.__class__.__module__.split('.', 1)[0]
87+
88+
if engine == "sqlite3":
8689
# SQLite's EXPLAIN dumps the low-level opcodes generated for a query;
8790
# EXPLAIN QUERY PLAN dumps a more human-readable summary
8891
# See http://www.sqlite.org/lang_explain.html for details

runtests.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77

88
if not settings.configured:
99
settings.configure(
10-
DATABASE_ENGINE='sqlite3',
11-
# HACK: this fixes our threaded runserver remote tests
12-
# DATABASE_NAME='test_sentry',
13-
# TEST_DATABASE_NAME='test_sentry',
10+
DATABASES = {
11+
'default': {
12+
'ENGINE': 'django.db.backends.sqlite3',
13+
}
14+
},
1415
INSTALLED_APPS=[
1516
'django.contrib.auth',
1617
'django.contrib.admin',
@@ -30,7 +31,7 @@
3031
SITE_ID=1,
3132
)
3233

33-
from django.test.simple import run_tests
34+
from django.test.simple import DjangoTestSuiteRunner
3435

3536
def runtests(*test_args, **kwargs):
3637
if 'south' in settings.INSTALLED_APPS:
@@ -41,7 +42,8 @@ def runtests(*test_args, **kwargs):
4142
test_args = ['tests']
4243
parent = dirname(abspath(__file__))
4344
sys.path.insert(0, parent)
44-
failures = run_tests(test_args, verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast'))
45+
test_runner = DjangoTestSuiteRunner(verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast'))
46+
failures = test_runner.run_tests(test_args)
4547
sys.exit(failures)
4648

4749
if __name__ == '__main__':
@@ -50,4 +52,4 @@ def runtests(*test_args, **kwargs):
5052

5153
(options, args) = parser.parse_args()
5254

53-
runtests(failfast=options.failfast, *args)
55+
runtests(failfast=options.failfast, *args)

0 commit comments

Comments
 (0)