Modernize test setup.

This commit is contained in:
Jannis Leidel
2015-02-15 13:48:14 +01:00
parent 5a2cf6f501
commit 48c174a232
11 changed files with 95 additions and 54 deletions

6
.coveragerc Normal file
View File

@@ -0,0 +1,6 @@
[run]
source = appconf
branch = 1
[report]
omit = *tests*

3
.gitignore vendored
View File

@@ -5,4 +5,5 @@ MANIFEST
*.egg-info
*.egg
docs/_build/
.coverage
.coverage
.tox/

View File

@@ -1,38 +1,30 @@
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
before_install:
- export DJANGO_SETTINGS_MODULE=appconf.test_settings
install:
- pip install -e .
- pip install https://github.com/django/django/archive/${DJANGO}.zip#egg=django
- pip install -r requirements/tests.txt
before_script:
- flake8 appconf --ignore=E501
script:
- coverage run --branch --source=appconf `which django-admin.py` test appconf
- coverage report --omit=appconf/test*
env:
- DJANGO=1.3.7
- DJANGO=1.4.5
- DJANGO=1.5.1
- DJANGO=1.7.4
- DJANGO=master
matrix:
exclude:
- python: "3.2"
env: DJANGO=1.3.7
- python: "3.2"
env: DJANGO=1.4.5
- python: "3.3"
env: DJANGO=1.3.7
- python: "3.3"
env: DJANGO=1.4.5
- python: "2.6"
env: DJANGO=1.7.4
- python: "2.6"
env: DJANGO=master
- TOXENV=flake8-py27
- TOXENV=flake8-py33
- TOXENV=py26-dj14
- TOXENV=py27-dj14
- TOXENV=py26-dj15
- TOXENV=py26-dj16
- TOXENV=py27-dj15
- TOXENV=py27-dj16
- TOXENV=py32-dj15
- TOXENV=py32-dj16
- TOXENV=py33-dj15
- TOXENV=py33-dj16
- TOXENV=py27-dj17
- TOXENV=py27-dj18
- TOXENV=py27-dj19
- TOXENV=py32-dj17
- TOXENV=py32-dj18
- TOXENV=py32-dj19
- TOXENV=py33-dj17
- TOXENV=py33-dj18
- TOXENV=py33-dj19
- TOXENV=py34-dj17
- TOXENV=py34-dj18
- TOXENV=py34-dj19
install:
- pip install tox
script:
- tox

View File

@@ -1,3 +0,0 @@
flake8
coverage
django-discover-runner==1.0

View File

@@ -28,13 +28,8 @@ setup(
author_email='jannis@leidel.info',
license='BSD',
url='http://django-appconf.readthedocs.org/',
packages=[
'appconf',
'appconf.tests',
],
install_requires=[
'six'
],
packages=['appconf'],
install_requires=['six'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',

View File

@@ -62,5 +62,5 @@ class CustomHolderConf(AppConf):
class Meta:
# instead of django.conf.settings
holder = 'appconf.tests.models.custom_holder'
holder = 'tests.models.custom_holder'
prefix = 'custom_holder'

View File

@@ -14,7 +14,7 @@ INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.auth',
'django.contrib.admin',
'appconf.tests',
'tests',
]
if django.VERSION[:2] < (1, 6):

View File

@@ -3,9 +3,9 @@ from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from appconf.tests.models import (AppConf, TestConf, PrefixConf,
YetAnotherPrefixConf, SeparateConf,
ProxyConf, CustomHolderConf, custom_holder)
from .models import (AppConf, TestConf, PrefixConf,
YetAnotherPrefixConf, SeparateConf,
ProxyConf, CustomHolderConf, custom_holder)
class TestConfTests(TestCase):
@@ -47,7 +47,7 @@ class TestConfTests(TestCase):
self.assertEqual(custom_conf.CUSTOM_VALUE3, 'custom3')
self.assertEqual(settings.TESTS_CUSTOM_VALUE3, 'custom3')
self.assertEqual(custom_conf.TESTS_CUSTOM_VALUE3, 'custom3')
self.assertTrue('appconf.tests' in custom_conf.INSTALLED_APPS)
self.assertTrue('tests' in custom_conf.INSTALLED_APPS)
def test_dir_members(self):
custom_conf = TestConf()
@@ -131,7 +131,7 @@ class RequiredSettingsTests(TestCase):
def test_value_is_defined(self):
class RequirementConf(AppConf):
class Meta:
holder = 'appconf.tests.models.custom_holder'
holder = 'tests.models.custom_holder'
prefix = 'holder'
required = ['VALUE']

50
tox.ini Normal file
View File

@@ -0,0 +1,50 @@
[tox]
skipsdist = True
usedevelop = True
minversion = 1.8
envlist =
flake8-py27,
flake8-py33,
py{26,27}-dj14,
py{26,27,32,33}-dj{15,16},
py{27,32,33,34}-dj{17,18,19},
[testenv]
basepython =
py26: python2.6
py27: python2.7
py32: python3.2
py33: python3.3
py34: python3.4
pypy: pypy
usedevelop = true
setenv =
PYTHONPATH = {toxinidir}
DJANGO_SETTINGS_MODULE=tests.test_settings
deps =
flake8
coverage
django-discover-runner
dj13: https://github.com/django/django/archive/stable/1.3.x.zip#egg=django
dj14: https://github.com/django/django/archive/stable/1.4.x.zip#egg=django
dj15: https://github.com/django/django/archive/stable/1.5.x.zip#egg=django
dj16: https://github.com/django/django/archive/stable/1.6.x.zip#egg=django
dj17: https://github.com/django/django/archive/stable/1.7.x.zip#egg=django
dj18: https://github.com/django/django/archive/stable/1.8.x.zip#egg=django
dj19: https://github.com/django/django/archive/master.zip#egg=django
commands =
coverage run {envbindir}/django-admin.py test -v2 {posargs:tests}
coverage report
[testenv:flake8-py27]
commands = flake8 appconf
deps = flake8
[testenv:flake8-py33]
commands = flake8 appconf
deps = flake8
[flake8]
exclude = .tox
ignore = E501