Fix deprecated warnings and add tox test

This commit is contained in:
Kudlaty
2013-04-16 11:16:00 +02:00
parent 20e99f3882
commit a56f53bcfe
3 changed files with 107 additions and 8 deletions

View File

@@ -34,9 +34,9 @@ class PostCompressSignalTestCase(TestCase):
post_compress.connect(callback)
self.js_node.output()
args, kwargs = callback.call_args
self.assertEquals(JsCompressor, kwargs['sender'])
self.assertEquals('js', kwargs['type'])
self.assertEquals('file', kwargs['mode'])
self.assertEqual(JsCompressor, kwargs['sender'])
self.assertEqual('js', kwargs['type'])
self.assertEqual('file', kwargs['mode'])
context = kwargs['context']
assert 'url' in context['compressed']
@@ -47,9 +47,9 @@ class PostCompressSignalTestCase(TestCase):
post_compress.connect(callback)
self.css_node.output()
args, kwargs = callback.call_args
self.assertEquals(CssCompressor, kwargs['sender'])
self.assertEquals('css', kwargs['type'])
self.assertEquals('file', kwargs['mode'])
self.assertEqual(CssCompressor, kwargs['sender'])
self.assertEqual('css', kwargs['type'])
self.assertEqual('file', kwargs['mode'])
context = kwargs['context']
assert 'url' in context['compressed']
@@ -65,4 +65,4 @@ class PostCompressSignalTestCase(TestCase):
callback = Mock(wraps=listener)
post_compress.connect(callback)
css_node.output()
self.assertEquals(3, callback.call_count)
self.assertEqual(3, callback.call_count)

View File

@@ -8,6 +8,8 @@ Author: Florent Xicluna
import re
from django.utils import six
_format_str_re = re.compile(
r'((?<!{)(?:{{)+' # '{{'
r'|(?:}})+(?!})' # '}}
@@ -128,7 +130,7 @@ def _format_field(value, parts, conv, spec, want_bytes=False):
value = value.strftime(str(spec))
else:
value = _strformat(value, spec)
if want_bytes and isinstance(value, unicode):
if want_bytes and isinstance(value, six.text_type):
return str(value)
return value

97
tox.ini Normal file
View File

@@ -0,0 +1,97 @@
[tox]
distribute = False
envlist =
py33-1.5.X,
py32-1.5.X,
py27-1.5.X,
py26-1.5.X,
py27-1.4.X,
py26-1.4.X
[testenv]
downloadcache = {toxworkdir}/_download/
commands =
django-admin.py --version
make test
[testenv:py33-1.5.X]
basepython = python3.3
deps =
Django>=1.5,<1.6
flake8
django-discover-runner
coverage
html5lib
mock
jinja2
lxml
BeautifulSoup4
[testenv:py32-1.5.X]
basepython = python3.2
deps =
Django>=1.5,<1.6
flake8
django-discover-runner
coverage
html5lib
mock
jinja2
lxml
BeautifulSoup4
[testenv:py27-1.5.X]
basepython = python2.7
deps =
Django>=1.5,<1.6
flake8
django-discover-runner
coverage
html5lib
mock
jinja2
lxml
BeautifulSoup
unittest2
[testenv:py26-1.5.X]
basepython = python2.6
deps =
Django>=1.5,<1.6
flake8
django-discover-runner
coverage
html5lib
mock
jinja2
lxml
BeautifulSoup
unittest2
[testenv:py27-1.4.X]
basepython = python2.7
deps =
Django>=1.4,<1.5
flake8
django-discover-runner
coverage
html5lib
mock
jinja2
lxml
BeautifulSoup
unittest2
[testenv:py26-1.4.X]
basepython = python2.6
deps =
Django>=1.4,<1.5
flake8
django-discover-runner
coverage
html5lib
mock
jinja2
lxml
BeautifulSoup
unittest2