Skip to content

Commit

Permalink
Merge pull request #178 from ticosax/drop-unmaintained-version-django
Browse files Browse the repository at this point in the history
Drop unmaintained version of  django and python
  • Loading branch information
ticosax committed Oct 4, 2017
2 parents deb94fd + 8f31899 commit 1060aca
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 103 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ build/
htmlcov/
*.pyc
dist/
tests/docs/_build/
80 changes: 59 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,69 @@
language: python
python: 3.5
sudo: false
cache: pip
env:
- TOXENV=flake8-py27
- TOXENV=flake8-py35
- TOXENV=readme-py27
- TOXENV=py27-dj18
- TOXENV=py27-dj19
- TOXENV=py27-djmaster
- TOXENV=py34-dj18
- TOXENV=py34-dj19
- TOXENV=py34-djmaster
- TOXENV=py35-dj18
- TOXENV=py35-dj19
- TOXENV=py35-djmaster
matrix:
allow_failures:
- env: TOXENV=py27-djmaster
- env: TOXENV=py34-djmaster
- env: TOXENV=py35-djmaster
- env: TOXENV=pypy-djmaster
include:
- env: TOXENV=flake8-py27
python: 2.7
- env: TOXENV=flake8-py36
python: 3.6
- env: TOXENV=readme-py27
python: 2.7
- env: TOXENV=py27-dj18
python: 2.7
- env: TOXENV=py27-dj110
python: 2.7
- env: TOXENV=py27-dj111
python: 2.7
- env: TOXENV=py34-dj18
python: 3.4
- env: TOXENV=py34-dj110
python: 3.4
- env: TOXENV=py34-dj111
python: 3.4
- env: TOXENV=py35-dj18
python: 3.5
- env: TOXENV=py35-dj110
python: 3.5
- env: TOXENV=py35-dj111
python: 3.5
- env: TOXENV=py36-dj18
python: 3.6
- env: TOXENV=py36-dj110
python: 3.6
- env: TOXENV=py36-dj111
python: 3.6
- env: TOXENV=pypy-dj18
python: pypy
- env: TOXENV=pypy-dj19
- env: TOXENV=pypy-dj110
python: pypy
- env: TOXENV=pypy-dj111
python: pypy
- env: TOXENV=py34-dj20
python: 3.4
- env: TOXENV=py34-djmaster
python: 3.4
- env: TOXENV=py35-dj20
python: 3.5
- env: TOXENV=py35-djmaster
python: 3.5
- env: TOXENV=py36-dj20
python: 3.6
- env: TOXENV=py36-djmaster
python: 3.6
allow_failures:
- env: TOXENV=py34-dj20
python: 3.4
- env: TOXENV=py35-dj20
python: 3.5
- env: TOXENV=py36-dj20
python: 3.6
- env: TOXENV=py34-djmaster
python: 3.4
- env: TOXENV=py35-djmaster
python: 3.5
- env: TOXENV=py36-djmaster
python: 3.6
install:
- pip install tox
script: tox -v
Expand All @@ -44,4 +82,4 @@ deploy:
on:
tags: true
repo: jazzband/django-configurations
condition: "$TOXENV = py27-dj19"
condition: "$TOXENV = py36-dj111"
2 changes: 1 addition & 1 deletion configurations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .base import Configuration
from .decorators import pristinemethod

__version__ = '2.0'
__version__ = '2.1'
__all__ = ['Configuration', 'pristinemethod']


Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def find_version(*parts):
author_email='jannis@leidel.info',
packages=['configurations'],
entry_points={
'console_scripts': [
'console_scripts': [
'django-cadmin = configurations.management:execute_from_command_line',
],
},
Expand All @@ -48,10 +48,11 @@ def find_version(*parts):
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Utilities',
],
zip_safe=False,
Expand Down
15 changes: 9 additions & 6 deletions tests/settings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@


class Test(Configuration):
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
BASE_DIR = os.path.abspath(
os.path.join(os.path.dirname(
os.path.abspath(__file__)), os.pardir))

ENV_LOADED = BooleanValue(False)

Expand Down Expand Up @@ -38,10 +40,11 @@ class Test(Configuration):
if django.VERSION[:2] < (1, 6):
TEST_RUNNER = 'discover_runner.DiscoverRunner'

def TEMPLATE_CONTEXT_PROCESSORS(self):
return tuple(Configuration.TEMPLATE_CONTEXT_PROCESSORS) + (
'tests.settings.base.test_callback',
)
@property
def ALLOWED_HOSTS(self):
allowed_hosts = super(Test, self).ALLOWED_HOSTS[:]
allowed_hosts.append('base')
return allowed_hosts

ATTRIBUTE_SETTING = True

Expand All @@ -54,7 +57,7 @@ def PROPERTY_SETTING(self):
def METHOD_SETTING(self):
return 2

LAMBDA_SETTING = lambda self: 3
LAMBDA_SETTING = lambda self: 3 # noqa: E731

PRISTINE_LAMBDA_SETTING = pristinemethod(lambda: 4)

Expand Down
23 changes: 12 additions & 11 deletions tests/settings/mixin_inheritance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@


class Mixin1(object):

@property
def TEMPLATE_CONTEXT_PROCESSORS(self):
return tuple(super(Mixin1, self).TEMPLATE_CONTEXT_PROCESSORS) + (
'some_app.context_processors.processor1',)
def ALLOWED_HOSTS(self):
allowed_hosts = super(Mixin1, self).ALLOWED_HOSTS[:]
allowed_hosts.append('test1')
return allowed_hosts


class Mixin2(object):

@property
def TEMPLATE_CONTEXT_PROCESSORS(self):
return tuple(super(Mixin2, self).TEMPLATE_CONTEXT_PROCESSORS) + (
'some_app.context_processors.processor2',)
def ALLOWED_HOSTS(self):
allowed_hosts = super(Mixin2, self).ALLOWED_HOSTS[:]
allowed_hosts.append('test2')
return allowed_hosts


class Inheritance(Mixin2, Mixin1, Configuration):

@property
def TEMPLATE_CONTEXT_PROCESSORS(self):
return tuple(super(Inheritance, self).TEMPLATE_CONTEXT_PROCESSORS) + (
'some_app.context_processors.processorbase',)
def ALLOWED_HOSTS(self):
allowed_hosts = super(Inheritance, self).ALLOWED_HOSTS[:]
allowed_hosts.append('test3')
return allowed_hosts
11 changes: 6 additions & 5 deletions tests/settings/multiple_inheritance.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from .main import Test
from .single_inheritance import Inheritance as BaseInheritance


class Inheritance(Test):
class Inheritance(BaseInheritance):

def TEMPLATE_CONTEXT_PROCESSORS(self):
return tuple(super(Inheritance, self).TEMPLATE_CONTEXT_PROCESSORS()) + (
'tests.settings.base.test_callback',)
def ALLOWED_HOSTS(self):
allowed_hosts = super(Inheritance, self).ALLOWED_HOSTS[:]
allowed_hosts.append('test-test')
return allowed_hosts
8 changes: 5 additions & 3 deletions tests/settings/single_inheritance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

class Inheritance(Base):

def TEMPLATE_CONTEXT_PROCESSORS(self):
return tuple(super(Inheritance, self).TEMPLATE_CONTEXT_PROCESSORS) + (
'tests.settings.base.test_callback',)
@property
def ALLOWED_HOSTS(self):
allowed_hosts = super(Inheritance, self).ALLOWED_HOSTS[:]
allowed_hosts.append('test')
return allowed_hosts
28 changes: 12 additions & 16 deletions tests/test_inheritance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os

from django.conf import global_settings
from django.test import TestCase

from mock import patch
Expand All @@ -13,30 +12,27 @@ class InheritanceTests(TestCase):
DJANGO_SETTINGS_MODULE='tests.settings.single_inheritance')
def test_inherited(self):
from tests.settings import single_inheritance
self.assertEqual(single_inheritance.TEMPLATE_CONTEXT_PROCESSORS,
tuple(global_settings.TEMPLATE_CONTEXT_PROCESSORS) + (
'tests.settings.base.test_callback',
))
self.assertEqual(
single_inheritance.ALLOWED_HOSTS,
['test']
)

@patch.dict(os.environ, clear=True,
DJANGO_CONFIGURATION='Inheritance',
DJANGO_SETTINGS_MODULE='tests.settings.multiple_inheritance')
def test_inherited2(self):
from tests.settings import multiple_inheritance
self.assertEqual(multiple_inheritance.TEMPLATE_CONTEXT_PROCESSORS,
tuple(global_settings.TEMPLATE_CONTEXT_PROCESSORS) + (
'tests.settings.base.test_callback',
'tests.settings.base.test_callback',
))
self.assertEqual(
multiple_inheritance.ALLOWED_HOSTS,
['test', 'test-test']
)

@patch.dict(os.environ, clear=True,
DJANGO_CONFIGURATION='Inheritance',
DJANGO_SETTINGS_MODULE='tests.settings.mixin_inheritance')
def test_inherited3(self):
from tests.settings import mixin_inheritance
self.assertEqual(mixin_inheritance.TEMPLATE_CONTEXT_PROCESSORS,
tuple(global_settings.TEMPLATE_CONTEXT_PROCESSORS) + (
'some_app.context_processors.processor1',
'some_app.context_processors.processor2',
'some_app.context_processors.processorbase',
))
self.assertEqual(
mixin_inheritance.ALLOWED_HOSTS,
['test1', 'test2', 'test3']
)
16 changes: 7 additions & 9 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import sys

from django import VERSION as DJANGO_VERSION
from django.conf import global_settings
from django.test import TestCase
from django.core.exceptions import ImproperlyConfigured

Expand All @@ -29,10 +28,7 @@ def test_simple(self):
self.assertTrue(lambda: callable(main.PRISTINE_LAMBDA_SETTING))
self.assertNotEqual(main.PRISTINE_FUNCTION_SETTING, 5)
self.assertTrue(lambda: callable(main.PRISTINE_FUNCTION_SETTING))
self.assertEqual(main.TEMPLATE_CONTEXT_PROCESSORS,
tuple(global_settings.TEMPLATE_CONTEXT_PROCESSORS) + (
'tests.settings.base.test_callback',
))
self.assertEqual(main.ALLOWED_HOSTS, ['base'])
self.assertEqual(main.PRE_SETUP_TEST_SETTING, 6)
self.assertRaises(AttributeError, lambda: main.POST_SETUP_TEST_SETTING)
self.assertEqual(main.Test.POST_SETUP_TEST_SETTING, 7)
Expand Down Expand Up @@ -74,8 +70,9 @@ def test_initialization(self):
importer = ConfigurationImporter()
self.assertEqual(importer.module, 'tests.settings.main')
self.assertEqual(importer.name, 'Test')
self.assertEqual(repr(importer),
"<ConfigurationImporter for 'tests.settings.main.Test'>")
self.assertEqual(
repr(importer),
"<ConfigurationImporter for 'tests.settings.main.Test'>")

@patch.dict(os.environ, clear=True,
DJANGO_SETTINGS_MODULE='tests.settings.inheritance',
Expand Down Expand Up @@ -123,8 +120,9 @@ def test_deprecated_option_list_command(self):
and which will become completely unsupported in Django 1.10.
https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/#custom-commands-options
"""
proc = subprocess.Popen(['django-cadmin', 'old_optparse_command', '--help'],
stdout=subprocess.PIPE)
proc = subprocess.Popen(
['django-cadmin', 'old_optparse_command', '--help'],
stdout=subprocess.PIPE)
output = proc.communicate()[0].decode('utf-8')
self.assertIn('--configuration', output)
self.assertIn('--arg1', output)
1 change: 0 additions & 1 deletion tests/test_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ def test_multiprocessing(self):
'.',
'_build/html',
], cwd=self.docs_dir, stderr=subprocess.STDOUT)
self.assertIn(b'waiting for workers', output)
self.assertIn(b'build succeeded.', output)

0 comments on commit 1060aca

Please sign in to comment.