Skip to content

Commit

Permalink
Merge pull request #26 from sergei-maertens/master
Browse files Browse the repository at this point in the history
Fix issue #25 and move to Tox for unit testing different build matrices
  • Loading branch information
sergei-maertens committed Sep 10, 2015
2 parents 1c3841c + b95612e commit 6edb85f
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ source = djchoices
omit = */tests/*
exclude_lines =
pragma: no cover

[html]
directory = cover
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dist/
*.pyc
.project
.pydevproject
.tox

# coverage
htmlcov
Expand Down
68 changes: 32 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,41 @@
language: python
sudo: false

python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "pypy"
install:
- pip install coverage coveralls tox
script:
- tox
after_success:
- coveralls

env:
- DJANGO_VERSION=1.3.7
- DJANGO_VERSION=1.4.22
- DJANGO_VERSION=1.5.12
- DJANGO_VERSION=1.6.11
- DJANGO_VERSION=1.7.10
- DJANGO_VERSION=1.8.4
- TOXENV=py26-django13
- TOXENV=py26-django14
- TOXENV=py26-django15
- TOXENV=py26-django16

matrix:
exclude:
- python: "2.6"
env: DJANGO_VERSION=1.7.10
- python: "2.6"
env: DJANGO_VERSION=1.8.4
- python: "3.3"
env: DJANGO_VERSION=1.3.7
- python: "3.3"
env: DJANGO_VERSION=1.4.22
- python: "3.4"
env: DJANGO_VERSION=1.3.7
- python: "3.4"
env: DJANGO_VERSION=1.4.22
- TOXENV=py27-django13
- TOXENV=py27-django14
- TOXENV=py27-django15
- TOXENV=py27-django16
- TOXENV=py27-django17
- TOXENV=py27-django18
- TOXENV=py27-djangolatest

# command to install dependencies
install:
- "pip install -q Django==$DJANGO_VERSION --use-mirrors"
- "if [[ $DJANGO_VERSION < 1.5 ]]; then pip install -q six --use-mirrors; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install -q unittest2; fi"
- "pip install coverage coveralls"
- TOXENV=py33-django15
- TOXENV=py33-django16
- TOXENV=py33-django17
- TOXENV=py33-django18
- TOXENV=py33-djangolatest

# command to run tests
script: coverage run runtests.py
- TOXENV=py34-django15
- TOXENV=py34-django16
- TOXENV=py34-django17
- TOXENV=py34-django18
- TOXENV=py34-djangolatest

after_success:
- coveralls
- TOXENV=pypy-django15
- TOXENV=pypy-django16
- TOXENV=pypy-django17
- TOXENV=pypy-django18
- TOXENV=pypy-djangolatest
4 changes: 3 additions & 1 deletion djchoices/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from pkg_resources import get_distribution

from djchoices.choices import ChoiceItem, DjangoChoices, C

__version__ = '1.4.1'
__version__ = get_distribution('django-choices').version

__all__ = ["ChoiceItem", "DjangoChoices", "C"]
10 changes: 9 additions & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@
from sys import stdout


if __name__ == "__main__":
def get_suite():
disc_folder = path.abspath(path.dirname(__file__))

stdout.write("Discovering tests in '%s'..." % disc_folder)
suite = unittest.TestSuite()
loader = unittest.loader.defaultTestLoader
suite.addTest(loader.discover(disc_folder, pattern="test*.py"))
stdout.write("Done.\n")
return suite


def run_tests():
suite = get_suite()
stdout.write("Running tests...\n")
runner = unittest.TextTestRunner()
runner.verbosity = 2
runner.run(suite.run)


if __name__ == "__main__":
run_tests()
13 changes: 3 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
from os import path
from setuptools import setup, find_packages

try:
from django.utils import six
except ImportError:
REQUIRE_SIX = True
else:
REQUIRE_SIX = False

from djchoices import __version__

with open(path.join(path.dirname(__file__), 'README.rst')) as f:
readme = f.read()

setup(
name="django-choices",
version=__version__,
version='1.4.2',
license="MIT",
description="Sanity for the django choices functionality.",
long_description=readme,
install_requires=['Django>=1.3'] + (['six'] if REQUIRE_SIX else []),
install_requires=['Django>=1.3', 'six'],
test_suite='runtests.get_suite',
url="https://github.com/bigjason/django-choices",
author="Jason Webb",
author_email="[email protected]",
Expand Down
17 changes: 17 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tox]
envlist = py{26,27}-django{13,14,15,16},py27-django{17,18,latest},py{33,34,py}-django{15,16,17,18,latest}
skip_missing_interpreters = true

[testenv]
deps=
django13: Django>=1.3,<1.4
django14: Django>=1.4,<1.5
django15: Django>=1.5,<1.6
django16: Django>=1.6,<1.7
django17: Django>=1.7,<1.8
django18: Django>=1.8,<1.9
py26: unittest2
django13,django14: six
coverage
coveralls
commands=coverage run --rcfile={toxinidir}/.coveragerc {toxinidir}/setup.py test

0 comments on commit 6edb85f

Please sign in to comment.