diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..ac62a0f --- /dev/null +++ b/.coveragerc @@ -0,0 +1,12 @@ +[run] +source = multiselectfield +omit = + example/* + +[report] +exclude_lines = + pragma: no cover + def __repr__ + raise NotImplementedError + if __name__ == .__main__.: + def parse_args \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6cca6a2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: python + +install: + - pip install -q --use-mirrors tox==1.6.1 coveralls==0.3 + +script: + - coverage erase + - tox +after_success: + - coverage combine + - coveralls + +notifications: + email: + - goinnn@gmail.com diff --git a/example/example/app/tests.py b/example/example/app/tests.py new file mode 100644 index 0000000..8fd7d0e --- /dev/null +++ b/example/example/app/tests.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2013 by Pablo Martín +# +# This software is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this software. If not, see . + +from django.test import TestCase + +from example.app.models import Book + + +class MultiSelectTestCase(TestCase): + + def test_filter(self): + self.assertEqual(Book.objects.filter(tags__contains='sex').count(), 1) + self.assertEqual(Book.objects.filter(tags__contains='boring').count(), 0) diff --git a/example/run_tests.py b/example/run_tests.py new file mode 100644 index 0000000..00c10f8 --- /dev/null +++ b/example/run_tests.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2013 by Pablo Martín +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this programe. If not, see . + +import os +import sys + +import django + +from django.conf import ENVIRONMENT_VARIABLE +from django.core import management + + +if len(sys.argv) == 1: + os.environ[ENVIRONMENT_VARIABLE] = 'example.settings' +else: + os.environ[ENVIRONMENT_VARIABLE] = sys.argv[1] + +if django.VERSION[0] == 1 and django.VERSION[1] <= 5: + management.call_command('test', 'app') +else: + management.call_command('test', 'example.app') diff --git a/example/settings_no_debug.py b/example/settings_no_debug.py new file mode 100644 index 0000000..b55fd38 --- /dev/null +++ b/example/settings_no_debug.py @@ -0,0 +1,4 @@ +from test_project.settings import * + +DEBUG = False +TEMPLATE_DEBUG = DEBUG diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..f275791 --- /dev/null +++ b/tox.ini @@ -0,0 +1,76 @@ +[tox] +envlist = py27-dj16,py27-dj15,py27-dj14,py33-dj16,py33-dj15,py26-dj16,py26-dj15,py26-dj14 + +[testenv] +usedevelop = True +commands = + python {envbindir}/coverage run -p example/run_tests.py + python {envbindir}/coverage run -p example/run_tests.py example.settings_no_debug +install_command = + pip install {opts} {packages} + +[testenv:py26-dj16] +basepython = python2.6 +deps = + django==1.6 + pillow==1.7.8 + PyYAML==3.10 + coveralls==0.3 + +[testenv:py26-dj15] +basepython = python2.6 +deps = + django==1.5.5 + pillow==1.7.8 + PyYAML==3.10 + coveralls==0.3 + +[testenv:py26-dj14] +basepython = python2.6 +deps = + django==1.4.10 + pillow==1.7.8 + PyYAML==3.10 + coveralls==0.3 + +[testenv:py27-dj16] +basepython = python2.7 +deps = + django==1.6 + pillow==1.7.8 + PyYAML==3.10 + coveralls==0.3 + + +[testenv:py27-dj15] +basepython = python2.7 +deps = + django==1.5.5 + pillow==1.7.8 + PyYAML==3.10 + coveralls==0.3 + +[testenv:py27-dj14] +basepython = python2.7 +deps = + django==1.4.10 + pillow==1.7.8 + PyYAML==3.10 + coveralls==0.3 + +[testenv:py33-dj16] +basepython = python3.3 +deps = + django==1.6 + pillow==2.1.0 + PyYAML==3.10 + coveralls==0.3 + + +[testenv:py33-dj15] +basepython = python3.3 +deps = + django==1.5.5 + pillow==2.1.0 + PyYAML==3.10 + coveralls==0.3