Adding tests for Django1.6 with Python2.7

* Fixed tox
* Fixed test_proj

--HG--
branch : supportdj16
This commit is contained in:
hirokiky 2013-12-08 17:29:20 +09:00
parent a4ada180e4
commit 8a213db74b
4 changed files with 37 additions and 11 deletions

View File

@ -6,12 +6,28 @@ import sys
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, path)
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
import django
def manage_16ormore():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
def manage_15orless():
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
execute_manager(settings)
if __name__ == "__main__":
execute_manager(settings)
if django.VERSION > (1, 6):
manage_16ormore()
else:
manage_15orless()

View File

@ -146,10 +146,11 @@ INSTALLED_APPS = [
try:
import django_coverage
TEST_RUNNER = 'django_coverage.coverage_runner.run_tests'
TEST_RUNNER = 'django_coverage.coverage_runner.CoverageRunner'
COVERAGE_REPORT_HTML_OUTPUT_DIR = os.path.join(PROJECT_PATH, '_coverage')
except ImportError:
pass
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
ADMIN_TOOLS_INDEX_DASHBOARD = 'test_proj.dashboard.CustomIndexDashboard'
ADMIN_TOOLS_MENU = 'test_proj.menu.CustomMenu'

View File

@ -1,4 +1,7 @@
from django.conf.urls.defaults import *
try:
from django.conf.urls import url, patterns, include
except ImportError:
from django.conf.urls.defaults import url, patterns, include
from django.conf import settings
from django.contrib import admin

View File

@ -1,5 +1,5 @@
[tox]
envlist = py26-dj13, py27-dj14, py27-dj15
envlist = py26-dj13, py27-dj14, py27-dj15, py27-dj16
[testenv:py26-dj13]
basepython = python2.6
@ -19,6 +19,12 @@ deps =
south
django==1.5
[testenv:py27-dj16]
basepython = python2.7
deps =
south
django==1.6
[testenv]
commands =
python -V