moved django test app settings to the django test app module
... to guarantee the settings get executed before any code in that app. Since python's unittest.TestLoader does not guarantee in what order it will import modules while hunting for test cases, the unit tests could fail to even load if tests.django_test_app.models was loaded before tests.test_django. This failure was seen on ARM machines, which happened to traverse the module tree in an inconvenient order.
This commit is contained in:
committed by
Raphaël Barrois
parent
b37206c015
commit
5688677a89
1
CREDITS
1
CREDITS
@@ -18,6 +18,7 @@ Contributors
|
||||
The project has received contributions from (in alphabetical order):
|
||||
|
||||
* Raphaël Barrois <raphael.barrois+semver@polytechnique.org> (https://github.com/rbarrois)
|
||||
* Michael Hrivnak <mhrivnak@hrivnak.org> (https://github.com/mhrivnak)
|
||||
|
||||
|
||||
Contributor license agreement
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2012-2014 The python-semanticversion project
|
||||
# This code is distributed under the two-clause BSD License.
|
||||
|
||||
try: # pragma: no cover
|
||||
from django.conf import settings
|
||||
django_loaded = True
|
||||
except ImportError: # pragma: no cover
|
||||
django_loaded = False
|
||||
|
||||
|
||||
if django_loaded: # pragma: no cover
|
||||
if not settings.configured:
|
||||
settings.configure(
|
||||
DATABASES={
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': 'tests/db/test.sqlite',
|
||||
}
|
||||
},
|
||||
INSTALLED_APPS=[
|
||||
'tests.django_test_app',
|
||||
]
|
||||
)
|
||||
|
||||
@@ -18,18 +18,6 @@ except ImportError: # pragma: no cover
|
||||
django_loaded = False
|
||||
|
||||
if django_loaded: # pragma: no cover
|
||||
if not settings.configured:
|
||||
settings.configure(
|
||||
DATABASES={
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': 'tests/db/test.sqlite',
|
||||
}
|
||||
},
|
||||
INSTALLED_APPS=[
|
||||
'tests.django_test_app',
|
||||
]
|
||||
)
|
||||
from .django_test_app import models
|
||||
from django.core import serializers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user