diff --git a/.gitignore b/.gitignore index 341cafe..cb3f83e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ dist example/example.db docs/_build .tox/ -*.egg/ \ No newline at end of file +*.egg/ +pep8.txt +coverage.xml +.coverage \ No newline at end of file diff --git a/dbtemplates/__init__.py b/dbtemplates/__init__.py index 458270e..e16f115 100644 --- a/dbtemplates/__init__.py +++ b/dbtemplates/__init__.py @@ -1,2 +1,2 @@ # following PEP 386, versiontools will pick it up -__version__ = (1, 2, 1, "final", 0) \ No newline at end of file +__version__ = (1, 2, 1, "final", 0) diff --git a/dbtemplates/test_settings.py b/dbtemplates/test_settings.py new file mode 100644 index 0000000..4b46789 --- /dev/null +++ b/dbtemplates/test_settings.py @@ -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', +) diff --git a/runtests.py b/runtests.py deleted file mode 100644 index 68b0b6c..0000000 --- a/runtests.py +++ /dev/null @@ -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:]) diff --git a/setup.py b/setup.py index 00e15f7..be12e1f 100644 --- a/setup.py +++ b/setup.py @@ -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/', diff --git a/tox.ini b/tox.ini index 5ab7af1..66f3dc6 100644 --- a/tox.ini +++ b/tox.ini @@ -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