Use better testrunner.

This commit is contained in:
Jannis Leidel 2011-09-06 12:32:24 +02:00
parent 1224ab4005
commit b6d5bfa226
6 changed files with 42 additions and 44 deletions

5
.gitignore vendored
View file

@ -7,4 +7,7 @@ dist
example/example.db
docs/_build
.tox/
*.egg/
*.egg/
pep8.txt
coverage.xml
.coverage

View file

@ -1,2 +1,2 @@
# following PEP 386, versiontools will pick it up
__version__ = (1, 2, 1, "final", 0)
__version__ = (1, 2, 1, "final", 0)

View file

@ -0,0 +1,18 @@
DBTEMPLATES_CACHE_BACKEND = 'dummy://'
DATABASE_ENGINE = 'sqlite3'
SITE_ID = 1
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.admin',
'dbtemplates',
]
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'dbtemplates.loader.Loader',
)

View file

@ -1,37 +0,0 @@
#!/usr/bin/env python
import os
import sys
from django.conf import settings
if not settings.configured:
settings.configure(
DBTEMPLATES_CACHE_BACKEND = 'dummy://',
DATABASE_ENGINE='sqlite3',
SITE_ID=1,
INSTALLED_APPS=[
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.admin',
'dbtemplates',
],
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'dbtemplates.loader.Loader',
)
)
from django.test.simple import run_tests
def runtests(*test_args):
if not test_args:
test_args = ['dbtemplates']
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'dbtemplates'))
failures = run_tests(test_args, verbosity=1, interactive=True)
sys.exit(failures)
if __name__ == '__main__':
runtests(*sys.argv[1:])

View file

@ -1,10 +1,14 @@
import codecs
from os import path
from setuptools import setup, find_packages
read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read()
setup(
name='django-dbtemplates',
version=__import__('dbtemplates').__version__,
version=':versiontools:dbtemplates:',
description='Template loader for templates stored in the database',
long_description=open('README.rst').read(),
long_description=read(path.join(path.dirname(__file__), 'README.rst')),
author='Jannis Leidel',
author_email='jannis@leidel.info',
url='http://django-dbtemplates.readthedocs.org/',

16
tox.ini
View file

@ -1,41 +1,51 @@
[tox]
downloadcache = .tox/_download/
distribute = False
distribute = false
envlist =
py25-1.2.X, py26-1.2.X, py27-1.2.X,
py25-1.3.X, py26-1.3.X, py27-1.3.X
[testenv]
downloadcache = {toxworkdir}/_download/
commands =
python runtests.py
{envbindir}/coverage erase
{envbindir}/coverage run --branch --source=dbtemplates {envbindir}/django-admin.py test {posargs:dbtemplates} --settings=dbtemplates.test_settings
{envbindir}/coverage report --omit=*test*
{envbindir}/coverage html --omit=*test* -d {envtmpdir}
echo "Type the following to open the coverage report: python -m webbrowser -t file://{envtmpdir}/index.html"
[testenv:py25-1.2.X]
basepython = python2.5
deps =
coverage
django==1.2.5
[testenv:py26-1.2.X]
basepython = python2.6
deps =
coverage
django==1.2.5
[testenv:py27-1.2.X]
basepython = python2.7
deps =
coverage
django==1.2.5
[testenv:py25-1.3.X]
basepython = python2.5
deps =
coverage
django==1.3
[testenv:py26-1.3.X]
basepython = python2.6
deps =
coverage
django==1.3
[testenv:py27-1.3.X]
basepython = python2.7
deps =
coverage
django==1.3