Fix tests and setup.py

This commit is contained in:
Bradley Ayers 2013-08-18 13:59:31 +10:00
parent 48182aa120
commit a8e940afc1
4 changed files with 64 additions and 29 deletions

View File

@ -4,7 +4,7 @@ from setuptools import setup, find_packages
with open('django_tables2/__init__.py', 'rb') as f:
version = re.search('__version__ = "(.+?)"', f.read().decode('utf-8')).group(1)
version = str(re.search('__version__ = "(.+?)"', f.read().decode('utf-8')).group(1))
setup(

View File

@ -58,10 +58,13 @@ class Region(models.Model):
# -- haystack -----------------------------------------------------------------
if not six.PY3: # Haystack isn't compatible with Python 3
from haystack import site
from haystack.indexes import CharField, SearchIndex
from haystack import indexes
class PersonIndex(SearchIndex):
first_name = CharField(document=True)
class PersonIndex(indexes.SearchIndex, indexes.Indexable):
first_name = indexes.CharField(document=True)
site.register(Person, PersonIndex)
def get_model(self):
return Person
def index_queryset(self, using=None):
return self.get_model().objects.all()

View File

@ -30,5 +30,8 @@ if not six.PY3: # Haystack isn't compatible with Python 3
INSTALLED_APPS += [
'haystack',
]
HAYSTACK_SEARCH_ENGINE = 'simple',
HAYSTACK_SITECONF = 'tests.app.models'
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
}
}

71
tox.ini
View File

@ -2,19 +2,28 @@
commands =
python -W error -W ignore::PendingDeprecationWarning {envbindir}/coverage run setup.py test
[tools]
testing =
[libs]
common =
http://github.com/bradleyayers/python-progressbar/tarball/master
http://github.com/dag/attest/tarball/master
coverage
django-attest
django-haystack
fudge
lxml
pylint
pytz
pytz>0
six
unittest-xml-reporting
for-dj =
django-haystack
for-dj15 =
django-haystack
for-dj14 =
django-haystack
for-dj13 =
django-haystack>=2.0.0,<2.1.0
for-dj12 =
django-haystack>=2.0.0,<2.1.0
[django]
latest = http://github.com/django/django/tarball/master
@ -27,7 +36,7 @@ latest = http://github.com/django/django/tarball/master
changedir = docs
commands = make html
deps =
{[tools]testing}
{[libs]common}
{[django]latest}
Sphinx
@ -35,96 +44,116 @@ deps =
[testenv:py33-dj]
basepython = python3.3
commands =
python {envbindir}/coverage run setup.py test []
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj}
{[django]latest}
[testenv:py33-dj15]
basepython = python3.3
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj15}
{[django]1.5.x}
; -- python 3.2 ---------------------------------------------------------------
[testenv:py32-dj]
basepython = python3.2
commands =
python {envbindir}/coverage run setup.py test []
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj}
{[django]latest}
[testenv:py32-dj15]
basepython = python3.2
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj15}
{[django]1.5.x}
; -- python 2.7 ---------------------------------------------------------------
[testenv:py27-dj]
basepython = python2.7
commands =
python {envbindir}/coverage run setup.py test []
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj}
{[django]latest}
[testenv:py27-dj15]
basepython = python2.7
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj15}
{[django]1.5.x}
[testenv:py27-dj14]
basepython = python2.7
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj14}
{[django]1.4.x}
[testenv:py27-dj13]
basepython = python2.7
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj13}
{[django]1.3.x}
[testenv:py27-dj12]
basepython = python2.7
commands =
python {envbindir}/coverage run setup.py test []
coverage html
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj12}
{[django]1.2.x}
; -- python 2.6 ---------------------------------------------------------------
[testenv:py26-dj]
basepython = python2.6
commands =
python {envbindir}/coverage run setup.py test []
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj}
{[django]latest}
[testenv:py26-dj15]
basepython = python2.6
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj15}
{[django]1.5.x}
[testenv:py26-dj14]
basepython = python2.6
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj14}
{[django]1.4.x}
[testenv:py26-dj13]
basepython = python2.6
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj13}
{[django]1.3.x}
[testenv:py26-dj12]
basepython = python2.6
commands =
python {envbindir}/coverage run setup.py test []
coverage html
deps =
{[tools]testing}
{[libs]common}
{[libs]for-dj12}
{[django]1.2.x}