Modernize test setup.
This commit is contained in:
6
.coveragerc
Normal file
6
.coveragerc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[run]
|
||||||
|
source = appconf
|
||||||
|
branch = 1
|
||||||
|
|
||||||
|
[report]
|
||||||
|
omit = *tests*
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ MANIFEST
|
|||||||
*.egg
|
*.egg
|
||||||
docs/_build/
|
docs/_build/
|
||||||
.coverage
|
.coverage
|
||||||
|
.tox/
|
||||||
64
.travis.yml
64
.travis.yml
@@ -1,38 +1,30 @@
|
|||||||
language: python
|
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:
|
env:
|
||||||
- DJANGO=1.3.7
|
- TOXENV=flake8-py27
|
||||||
- DJANGO=1.4.5
|
- TOXENV=flake8-py33
|
||||||
- DJANGO=1.5.1
|
- TOXENV=py26-dj14
|
||||||
- DJANGO=1.7.4
|
- TOXENV=py27-dj14
|
||||||
- DJANGO=master
|
- TOXENV=py26-dj15
|
||||||
|
- TOXENV=py26-dj16
|
||||||
matrix:
|
- TOXENV=py27-dj15
|
||||||
exclude:
|
- TOXENV=py27-dj16
|
||||||
- python: "3.2"
|
- TOXENV=py32-dj15
|
||||||
env: DJANGO=1.3.7
|
- TOXENV=py32-dj16
|
||||||
- python: "3.2"
|
- TOXENV=py33-dj15
|
||||||
env: DJANGO=1.4.5
|
- TOXENV=py33-dj16
|
||||||
- python: "3.3"
|
- TOXENV=py27-dj17
|
||||||
env: DJANGO=1.3.7
|
- TOXENV=py27-dj18
|
||||||
- python: "3.3"
|
- TOXENV=py27-dj19
|
||||||
env: DJANGO=1.4.5
|
- TOXENV=py32-dj17
|
||||||
- python: "2.6"
|
- TOXENV=py32-dj18
|
||||||
env: DJANGO=1.7.4
|
- TOXENV=py32-dj19
|
||||||
- python: "2.6"
|
- TOXENV=py33-dj17
|
||||||
env: DJANGO=master
|
- TOXENV=py33-dj18
|
||||||
|
- TOXENV=py33-dj19
|
||||||
|
- TOXENV=py34-dj17
|
||||||
|
- TOXENV=py34-dj18
|
||||||
|
- TOXENV=py34-dj19
|
||||||
|
install:
|
||||||
|
- pip install tox
|
||||||
|
script:
|
||||||
|
- tox
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
flake8
|
|
||||||
coverage
|
|
||||||
django-discover-runner==1.0
|
|
||||||
9
setup.py
9
setup.py
@@ -28,13 +28,8 @@ setup(
|
|||||||
author_email='jannis@leidel.info',
|
author_email='jannis@leidel.info',
|
||||||
license='BSD',
|
license='BSD',
|
||||||
url='http://django-appconf.readthedocs.org/',
|
url='http://django-appconf.readthedocs.org/',
|
||||||
packages=[
|
packages=['appconf'],
|
||||||
'appconf',
|
install_requires=['six'],
|
||||||
'appconf.tests',
|
|
||||||
],
|
|
||||||
install_requires=[
|
|
||||||
'six'
|
|
||||||
],
|
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
'Environment :: Web Environment',
|
'Environment :: Web Environment',
|
||||||
|
|||||||
@@ -62,5 +62,5 @@ class CustomHolderConf(AppConf):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
# instead of django.conf.settings
|
# instead of django.conf.settings
|
||||||
holder = 'appconf.tests.models.custom_holder'
|
holder = 'tests.models.custom_holder'
|
||||||
prefix = 'custom_holder'
|
prefix = 'custom_holder'
|
||||||
@@ -14,7 +14,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'appconf.tests',
|
'tests',
|
||||||
]
|
]
|
||||||
|
|
||||||
if django.VERSION[:2] < (1, 6):
|
if django.VERSION[:2] < (1, 6):
|
||||||
@@ -3,7 +3,7 @@ from django.conf import settings
|
|||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from appconf.tests.models import (AppConf, TestConf, PrefixConf,
|
from .models import (AppConf, TestConf, PrefixConf,
|
||||||
YetAnotherPrefixConf, SeparateConf,
|
YetAnotherPrefixConf, SeparateConf,
|
||||||
ProxyConf, CustomHolderConf, custom_holder)
|
ProxyConf, CustomHolderConf, custom_holder)
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ class TestConfTests(TestCase):
|
|||||||
self.assertEqual(custom_conf.CUSTOM_VALUE3, 'custom3')
|
self.assertEqual(custom_conf.CUSTOM_VALUE3, 'custom3')
|
||||||
self.assertEqual(settings.TESTS_CUSTOM_VALUE3, 'custom3')
|
self.assertEqual(settings.TESTS_CUSTOM_VALUE3, 'custom3')
|
||||||
self.assertEqual(custom_conf.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):
|
def test_dir_members(self):
|
||||||
custom_conf = TestConf()
|
custom_conf = TestConf()
|
||||||
@@ -131,7 +131,7 @@ class RequiredSettingsTests(TestCase):
|
|||||||
def test_value_is_defined(self):
|
def test_value_is_defined(self):
|
||||||
class RequirementConf(AppConf):
|
class RequirementConf(AppConf):
|
||||||
class Meta:
|
class Meta:
|
||||||
holder = 'appconf.tests.models.custom_holder'
|
holder = 'tests.models.custom_holder'
|
||||||
prefix = 'holder'
|
prefix = 'holder'
|
||||||
required = ['VALUE']
|
required = ['VALUE']
|
||||||
|
|
||||||
50
tox.ini
Normal file
50
tox.ini
Normal 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
|
||||||
Reference in New Issue
Block a user