Cleanup setup.py, remove python 3.3 compat and add django 1.8+master testing.

This commit is contained in:
Christopher Grebs 2015-04-22 16:02:16 +02:00
parent eefada10f8
commit 3779bd450a
3 changed files with 25 additions and 43 deletions

View File

@ -1,10 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import codecs
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
def read(*parts):
@ -24,7 +22,7 @@ test_requires = [
install_requires = [
'django>=1.4,<1.8',
'django>=1.4,<1.9',
'babel>=1.3',
]
@ -35,21 +33,6 @@ dev_requires = [
'twine'
]
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
setup(
name='django-babel',
description='Utilities for using Babel in Django',
@ -62,7 +45,6 @@ setup(
packages=find_packages(exclude=('tests',)),
tests_require=test_requires,
install_requires=install_requires,
cmdclass={'test': PyTest},
extras_require={
'docs': ['sphinx'],
'tox': ['tox'],
@ -82,7 +64,6 @@ setup(
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: CPython',

View File

@ -6,6 +6,7 @@ from babel.messages import extract
from babel._compat import BytesIO
from django_babel.extract import extract_django
from django.utils.encoding import force_bytes
default_keys = extract.DEFAULT_KEYWORDS.keys()
@ -45,12 +46,12 @@ class ExtractDjangoTestCase(unittest.TestCase):
self.assertEqual([(1, None, u'xxx%(anton)sxxx', [])], messages)
def test_extract_unicode(self):
buf = BytesIO(b'{% trans "@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ" %}')
buf = BytesIO(force_bytes('{% trans "@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ" %}'))
messages = list(extract_django(buf, default_keys, [], {}))
self.assertEqual([(1, None, u'@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ', [])], messages)
def test_extract_unicode_blocktrans(self):
buf = BytesIO(b'{% blocktrans %}@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ{% endblocktrans %}')
buf = BytesIO(force_bytes('{% blocktrans %}@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ{% endblocktrans %}'))
messages = list(extract_django(buf, default_keys, [], {}))
self.assertEqual([(1, None, u'@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ', [])], messages)
@ -78,7 +79,7 @@ class ExtractDjangoTestCase(unittest.TestCase):
def test_trans_blocks_must_not_include_other_block_tags(self):
buf = BytesIO(b'{% blocktrans %}{% other_tag %}{% endblocktrans %}')
gen = extract_django(buf, default_keys, [], {})
pytest.raises(SyntaxError, gen.next)
pytest.raises(SyntaxError, next, gen)
def test_extract_var(self):
buf = BytesIO(b'{{ book }}')

40
tox.ini
View File

@ -2,17 +2,21 @@
skipsdist = True
usedevelop = True
commands =
pip install --upgrade setuptools pip
pip install -e {toxinidir}
pip install -e {toxinidir}[tests]
py.test
deps15 =
https://github.com/django/django/archive/stable/1.5.x.zip#egg=django
https://github.com/django/django/archive/stable/1.5.x.tar.gz#egg=django
deps16 =
https://github.com/django/django/archive/stable/1.6.x.zip#egg=django
https://github.com/django/django/archive/stable/1.6.x.tar.gz#egg=django
deps17 =
https://github.com/django/django/archive/stable/1.7.x.zip#egg=django
https://github.com/django/django/archive/stable/1.7.x.tar.gz#egg=django
deps18 =
https://github.com/django/django/archive/stable/1.8.x.tar.gz#egg=django
master =
https://github.com/django/django/archive/stable/1.7.x.zip#egg=django
https://github.com/django/django/archive/master.tar.gz#egg=django
[testenv:2.6-1.5.x]
basepython = python2.6
@ -34,26 +38,14 @@ deps = {[testenv]deps16}
basepython = python2.7
deps = {[testenv]deps17}
[testenv:2.7-1.8.x]
basepython = python2.7
deps = {[testenv]deps18}
[testenv:2.7-master]
basepython = python2.7
deps = {[testenv]master}
[testenv:3.3-1.5.x]
basepython = python3.3
deps = {[testenv]deps15}
[testenv:3.3-1.6.x]
basepython = python3.3
deps = {[testenv]deps16}
[testenv:3.3-1.7.x]
basepython = python3.3
deps = {[testenv]deps17}
[testenv:3.3-master]
basepython = python3.3
deps = {[testenv]master}
[testenv:3.4-1.5.x]
basepython = python3.4
deps = {[testenv]deps15}
@ -66,6 +58,10 @@ deps = {[testenv]deps16}
basepython = python3.4
deps = {[testenv]deps17}
[testenv:3.4-1.8.x]
basepython = python3.4
deps = {[testenv]deps18}
[testenv:3.4-master]
basepython = python3.4
deps = {[testenv]master}
@ -82,6 +78,10 @@ deps = {[testenv]deps17}
basepython = pypy
deps = {[testenv]deps17}
[testenv:pypy-1.8.x]
basepython = pypy
deps = {[testenv]deps18}
[testenv:pypy-master]
basepython = pypy
deps = {[testenv]master}