Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving testing using tox #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.rst
Expand Up @@ -116,7 +116,16 @@ On Django >= 1.3::
},
}

Tests
-----

A real redis server is required to test this package, then run tox to test against supported versions::

$ redis-server --unixsocket /tmp/redis.sock --requirepass yadayada
$ tox

.. _redis: http://redis.io
.. _redis-py: http://github.com/andymccurdy/redis-py/
.. _hiredis: https://github.com/pietern/hiredis-py


9 changes: 8 additions & 1 deletion sockettests.py
Expand Up @@ -20,16 +20,23 @@
'LOCATION': '/tmp/redis.sock',
'OPTIONS': {
'DB': 15,
'PASSWORD': 'yadayada',
'PARSER_CLASS': 'redis.connection.HiredisParser'
},
},
},
'MIDDLEWARE_CLASSES': ('django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware'),
}

if not settings.configured:
settings.configure(**cache_settings)

import django
try:
django.setup()
except AttributeError:
pass

from django.test.simple import DjangoTestSuiteRunner

def runtests(*test_args):
Expand Down
8 changes: 8 additions & 0 deletions tcptests.py
Expand Up @@ -28,12 +28,20 @@
},
},
},
'MIDDLEWARE_CLASSES': ('django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware'),
}


if not settings.configured:
settings.configure(**cache_settings)

import django
try:
django.setup()
except AttributeError:
pass

from django.test.simple import DjangoTestSuiteRunner

def runtests(*test_args):
Expand Down
92 changes: 92 additions & 0 deletions tox.ini
@@ -0,0 +1,92 @@
[tox]
envlist =
py26-django14, py26-django15, py26-django16,
py27-django14, py27-django15, py27-django16, py27-django17,
py33-django15, py33-django16, py33-django17,

[testenv]
downloadcache = {toxworkdir}/cache/
commands=
python sockettests.py
python tcptests.py
deps =
redis>=2.4.5
hiredis

[testenv:py26-django14]
basepython = python2.6
deps =
Django<1.5
{[testenv]deps}

[testenv:py26-django15]
basepython = python2.6
deps =
Django<1.6
{[testenv]deps}

[testenv:py26-django16]
basepython = python2.6
deps =
Django<1.7
{[testenv]deps}

[testenv:py27-django14]
basepython = python2.7
deps =
Django<1.5
{[testenv]deps}

[testenv:py27-django15]
basepython = python2.7
deps =
Django<1.6
{[testenv]deps}

[testenv:py27-django16]
basepython = python2.7
deps =
Django<1.7
{[testenv]deps}

[testenv:py27-django17]
basepython = python2.7
deps =
Django<1.8
{[testenv]deps}

[testenv:py33-django15]
basepython = python3.3
deps =
Django<1.6
{[testenv]deps}

[testenv:py33-django16]
basepython = python3.3
deps =
Django<1.7
{[testenv]deps}

[testenv:py33-django17]
basepython = python3.3
deps =
Django<1.8
{[testenv]deps}

[testenv:py34-django15]
basepython = python3.4
deps =
Django<1.6
{[testenv]deps}

[testenv:py34-django16]
basepython = python3.4
deps =
Django<1.7
{[testenv]deps}

[testenv:py34-django17]
basepython = python3.4
deps =
Django<1.8
{[testenv]deps}