diff --git a/.travis.yml b/.travis.yml
index abe6e96..363c7e1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,24 +1,17 @@
-sudo: false
language: python
cache: pip
python:
-- 2.7
- 3.5
- 3.6
-- pypy
+- 3.7
+- 3.8
- pypy3
install: pip install tox-travis
script: tox
-matrix:
- include:
- - python: 3.7
- dist: xenial
- sudo: required
deploy:
provider: pypi
user: jazzband
server: https://jazzband.co/projects/django-constance/upload
- distributions: sdist bdist_wheel
password:
secure: fvFbH0oZGYDad2rik7v0L+G4ItH0g/2v8hoBSajeyt/nEyoEShTh2xBwo5413NGkDaIYtYpP/MVqBy02uMc8oSNgh/rS1tIjiIKE77/YJNuZHyQXnZ+90JA+yGaJc5dOyd4G3szEp2Zzi18ov2KkCt37/arObu8bEbChWaEoJqI=
on:
diff --git a/constance/admin.py b/constance/admin.py
index 64feedc..70f0d37 100644
--- a/constance/admin.py
+++ b/constance/admin.py
@@ -20,7 +20,6 @@ from django.utils.encoding import smart_bytes
from django.utils.formats import localize
from django.utils.module_loading import import_string
from django.utils.translation import ugettext_lazy as _
-import six
from . import LazyConfig, settings
from .checks import get_inconsistent_fieldnames
@@ -79,12 +78,6 @@ def parse_additional_fields(fields):
FIELDS.update(parse_additional_fields(settings.ADDITIONAL_FIELDS))
-if not six.PY3:
- FIELDS.update({
- long: INTEGER_LIKE,
- unicode: STRING_LIKE,
- })
-
def get_values():
"""
@@ -105,7 +98,7 @@ class ConstanceForm(forms.Form):
version = forms.CharField(widget=forms.HiddenInput)
def __init__(self, initial, *args, **kwargs):
- super(ConstanceForm, self).__init__(*args, initial=initial, **kwargs)
+ super().__init__(*args, initial=initial, **kwargs)
version_hash = hashlib.md5()
for name, options in settings.CONFIG.items():
@@ -163,7 +156,7 @@ class ConstanceForm(forms.Form):
return value
def clean(self):
- cleaned_data = super(ConstanceForm, self).clean()
+ cleaned_data = super().clean()
if not settings.CONFIG_FIELDSETS:
return cleaned_data
@@ -294,11 +287,11 @@ class ConstanceAdmin(admin.ModelAdmin):
def has_change_permission(self, request, obj=None):
if settings.SUPERUSER_ONLY:
return request.user.is_superuser
- return super(ConstanceAdmin, self).has_change_permission(request, obj)
+ return super().has_change_permission(request, obj)
-class Config(object):
- class Meta(object):
+class Config:
+ class Meta:
app_label = 'constance'
object_name = 'Config'
model_name = module_name = 'config'
diff --git a/constance/apps.py b/constance/apps.py
index 25099a8..e36a0ed 100644
--- a/constance/apps.py
+++ b/constance/apps.py
@@ -7,7 +7,7 @@ class ConstanceConfig(AppConfig):
verbose_name = 'Constance'
def ready(self):
- super(ConstanceConfig, self).ready()
+ super().ready()
signals.post_migrate.connect(self.create_perm,
dispatch_uid='constance.create_perm')
diff --git a/constance/backends/__init__.py b/constance/backends/__init__.py
index a64905e..09ed5b7 100644
--- a/constance/backends/__init__.py
+++ b/constance/backends/__init__.py
@@ -3,7 +3,7 @@ Defines the base constance backend
"""
-class Backend(object):
+class Backend:
def get(self, key):
"""
diff --git a/constance/backends/database/migrations/0001_initial.py b/constance/backends/database/migrations/0001_initial.py
index e0ebd99..6a0400d 100644
--- a/constance/backends/database/migrations/0001_initial.py
+++ b/constance/backends/database/migrations/0001_initial.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
import picklefield.fields
diff --git a/constance/backends/database/models.py b/constance/backends/database/models.py
index 088fd79..f8808fc 100644
--- a/constance/backends/database/models.py
+++ b/constance/backends/database/models.py
@@ -20,5 +20,5 @@ class Constance(models.Model):
verbose_name_plural = _('constances')
db_table = 'constance_config'
- def __unicode__(self):
+ def __str__(self):
return self.key
diff --git a/constance/backends/database/south_migrations/0001_initial.py b/constance/backends/database/south_migrations/0001_initial.py
index f9b7473..d9bb96f 100644
--- a/constance/backends/database/south_migrations/0001_initial.py
+++ b/constance/backends/database/south_migrations/0001_initial.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
diff --git a/constance/backends/database/south_migrations/0002_auto__chg_field_constance_key__add_unique_constance_key.py b/constance/backends/database/south_migrations/0002_auto__chg_field_constance_key__add_unique_constance_key.py
index ef8fb3c..98b9e7c 100644
--- a/constance/backends/database/south_migrations/0002_auto__chg_field_constance_key__add_unique_constance_key.py
+++ b/constance/backends/database/south_migrations/0002_auto__chg_field_constance_key__add_unique_constance_key.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
diff --git a/constance/backends/redisd.py b/constance/backends/redisd.py
index 9e5bb58..6d25b60 100644
--- a/constance/backends/redisd.py
+++ b/constance/backends/redisd.py
@@ -1,19 +1,15 @@
from django.core.exceptions import ImproperlyConfigured
-import six
from . import Backend
from .. import settings, utils, signals, config
-try:
- from cPickle import loads, dumps
-except ImportError:
- from pickle import loads, dumps
+from pickle import loads, dumps
class RedisBackend(Backend):
def __init__(self):
- super(RedisBackend, self).__init__()
+ super().__init__()
self._prefix = settings.REDIS_PREFIX
connection_cls = settings.REDIS_CONNECTION_CLASS
if connection_cls is not None:
@@ -24,7 +20,7 @@ class RedisBackend(Backend):
except ImportError:
raise ImproperlyConfigured(
"The Redis backend requires redis-py to be installed.")
- if isinstance(settings.REDIS_CONNECTION, six.string_types):
+ if isinstance(settings.REDIS_CONNECTION, str):
self._rd = redis.from_url(settings.REDIS_CONNECTION)
else:
self._rd = redis.Redis(**settings.REDIS_CONNECTION)
@@ -42,7 +38,7 @@ class RedisBackend(Backend):
if not keys:
return
prefixed_keys = [self.add_prefix(key) for key in keys]
- for key, value in six.moves.zip(keys, self._rd.mget(prefixed_keys)):
+ for key, value in zip(keys, self._rd.mget(prefixed_keys)):
if value:
yield key, loads(value)
diff --git a/constance/base.py b/constance/base.py
index 72812ad..b7bdb24 100644
--- a/constance/base.py
+++ b/constance/base.py
@@ -1,12 +1,12 @@
from . import settings, utils
-class Config(object):
+class Config:
"""
The global config wrapper that handles the backend.
"""
def __init__(self):
- super(Config, self).__setattr__('_backend',
+ super().__setattr__('_backend',
utils.import_module_attr(settings.BACKEND)())
def __getattr__(self, key):
diff --git a/constance/management/commands/constance.py b/constance/management/commands/constance.py
index 0fc48f2..4d78769 100644
--- a/constance/management/commands/constance.py
+++ b/constance/management/commands/constance.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-
-from __future__ import unicode_literals
-
from django.core.exceptions import ValidationError
from django.core.management import BaseCommand, CommandError
from django.utils.translation import ugettext as _
diff --git a/constance/templates/admin/constance/change_list.html b/constance/templates/admin/constance/change_list.html
index 6f5b937..6b45032 100644
--- a/constance/templates/admin/constance/change_list.html
+++ b/constance/templates/admin/constance/change_list.html
@@ -1,5 +1,5 @@
{% extends "admin/base_site.html" %}
-{% load admin_static admin_list i18n %}
+{% load admin_list static i18n %}
{% block extrastyle %}
{{ block.super }}
diff --git a/constance/templates/admin/constance/includes/results_list.html b/constance/templates/admin/constance/includes/results_list.html
index b13c4ee..9ef4782 100644
--- a/constance/templates/admin/constance/includes/results_list.html
+++ b/constance/templates/admin/constance/includes/results_list.html
@@ -1,4 +1,4 @@
-{% load admin_static admin_list static i18n %}
+{% load admin_list static i18n %}
diff --git a/constance/test/utils.py b/constance/test/utils.py
index eff0abd..91366ae 100644
--- a/constance/test/utils.py
+++ b/constance/test/utils.py
@@ -15,7 +15,7 @@ class override_config(override_settings):
Based on django.test.utils.override_settings.
"""
def __init__(self, **kwargs):
- super(override_config, self).__init__(**kwargs)
+ super().__init__(**kwargs)
self.original_values = {}
def __call__(self, test_func):
diff --git a/docs/conf.py b/docs/conf.py
index 51c8242..2f87585 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-#
# django-constance documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 25 19:38:51 2014.
#
@@ -45,8 +43,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'django-constance'
-copyright = u'2017, Jazzband'
+project = 'django-constance'
+copyright = '2017, Jazzband'
# The short X.Y version.
try:
@@ -199,8 +197,8 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
- ('index', 'django-constance.tex', u'django-constance Documentation',
- u'Jazzband', 'manual'),
+ ('index', 'django-constance.tex', 'django-constance Documentation',
+ 'Jazzband', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -229,8 +227,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'django-constance', u'django-constance Documentation',
- [u'Jazzband'], 1)
+ ('index', 'django-constance', 'django-constance Documentation',
+ ['Jazzband'], 1)
]
# If true, show URL addresses after external links.
@@ -243,8 +241,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'django-constance', u'django-constance Documentation',
- u'Jazzband', 'django-constance', 'One line description of project.',
+ ('index', 'django-constance', 'django-constance Documentation',
+ 'Jazzband', 'django-constance', 'One line description of project.',
'Miscellaneous'),
]
diff --git a/docs/index.rst b/docs/index.rst
index 07c2b02..818f24b 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -109,9 +109,7 @@ The supported types are:
* ``int``
* ``float``
* ``Decimal``
-* ``long`` (on python 2)
* ``str``
-* ``unicode`` (on python 2)
* ``datetime``
* ``date``
* ``time``
@@ -359,7 +357,7 @@ settings the way you like.
from constance.admin import ConstanceAdmin, ConstanceForm, Config
class CustomConfigForm(ConstanceForm):
def __init__(self, *args, **kwargs):
- super(CustomConfigForm, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
#... do stuff to make your settings form nice ...
class ConfigAdmin(ConstanceAdmin):
@@ -384,7 +382,7 @@ request. For example:
if request.user.is_superuser:
return SuperuserForm:
else:
- return super(MyConstanceAdmin, self).get_changelist_form(request)
+ return super().get_changelist_form(request)
Note that the default method returns ``self.change_list_form``.
diff --git a/example/cheeseshop/apps/catalog/migrations/0001_initial.py b/example/cheeseshop/apps/catalog/migrations/0001_initial.py
index f77e3b6..0a1f1e0 100644
--- a/example/cheeseshop/apps/catalog/migrations/0001_initial.py
+++ b/example/cheeseshop/apps/catalog/migrations/0001_initial.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
diff --git a/example/cheeseshop/apps/storage/migrations/0001_initial.py b/example/cheeseshop/apps/storage/migrations/0001_initial.py
index 9ef1e33..d0a06c3 100644
--- a/example/cheeseshop/apps/storage/migrations/0001_initial.py
+++ b/example/cheeseshop/apps/storage/migrations/0001_initial.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 2a9acf1..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[bdist_wheel]
-universal = 1
diff --git a/setup.py b/setup.py
index 6edb3d3..831b374 100644
--- a/setup.py
+++ b/setup.py
@@ -22,31 +22,30 @@ def find_version(*file_paths):
setup(
name='django-constance',
version=find_version("constance", "__init__.py"),
- url="http://github.com/jazzband/django-constance",
+ url="https://github.com/jazzband/django-constance",
description='Django live settings with pluggable backends, including Redis.',
long_description=read('README.rst'),
author='Jannis Leidel',
author_email='jannis@leidel.info',
license='BSD',
keywords='django libraries settings redis'.split(),
- platforms='any',
+ platforms=['any'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
- 'Framework :: Django :: 1.11',
- 'Framework :: Django :: 2.1',
+ 'Framework :: Django :: 2.2',
+ 'Framework :: Django :: 3.0',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Utilities',
@@ -54,7 +53,6 @@ setup(
packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
zip_safe=False,
- install_requires=['six'],
extras_require={
'database': ['django-picklefield'],
'redis': ['redis'],
diff --git a/tests/settings.py b/tests/settings.py
index 404e111..aea3359 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -1,6 +1,3 @@
-# -*- encoding: utf-8 -*-
-from django.utils import six
-
from datetime import datetime, date, time, timedelta
from decimal import Decimal
@@ -46,11 +43,6 @@ ROOT_URLCONF = 'tests.urls'
CONSTANCE_REDIS_CONNECTION_CLASS = 'tests.redis_mockup.Connection'
-long_value = 123456
-
-if not six.PY3:
- long_value = long(long_value)
-
CONSTANCE_ADDITIONAL_FIELDS = {
'yes_no_null_select': [
'django.forms.fields.ChoiceField',
@@ -67,10 +59,8 @@ USE_TZ = True
CONSTANCE_CONFIG = {
'INT_VALUE': (1, 'some int'),
- 'LONG_VALUE': (long_value, 'some looong int'),
'BOOL_VALUE': (True, 'true or false'),
'STRING_VALUE': ('Hello world', 'greetings'),
- 'UNICODE_VALUE': (u'Rivière-Bonjour რუსთაველი', 'greetings'),
'DECIMAL_VALUE': (Decimal('0.1'), 'the first release version'),
'DATETIME_VALUE': (datetime(2010, 8, 23, 11, 29, 24),
'time of the first commit'),
diff --git a/tests/storage.py b/tests/storage.py
index 738821e..2c3e5f6 100644
--- a/tests/storage.py
+++ b/tests/storage.py
@@ -1,28 +1,19 @@
-# -*- encoding: utf-8 -*-
from datetime import datetime, date, time, timedelta
from decimal import Decimal
-from django.utils import six
-
from constance.base import Config
-if six.PY3:
- def long(value):
- return value
-
-class StorageTestsMixin(object):
+class StorageTestsMixin:
def setUp(self):
self.config = Config()
- super(StorageTestsMixin, self).setUp()
+ super().setUp()
def test_store(self):
self.assertEqual(self.config.INT_VALUE, 1)
- self.assertEqual(self.config.LONG_VALUE, long(123456))
self.assertEqual(self.config.BOOL_VALUE, True)
self.assertEqual(self.config.STRING_VALUE, 'Hello world')
- self.assertEqual(self.config.UNICODE_VALUE, u'Rivière-Bonjour რუსთაველი')
self.assertEqual(self.config.DECIMAL_VALUE, Decimal('0.1'))
self.assertEqual(self.config.DATETIME_VALUE, datetime(2010, 8, 23, 11, 29, 24))
self.assertEqual(self.config.FLOAT_VALUE, 3.1415926536)
@@ -34,10 +25,8 @@ class StorageTestsMixin(object):
# set values
self.config.INT_VALUE = 100
- self.config.LONG_VALUE = long(654321)
self.config.BOOL_VALUE = False
self.config.STRING_VALUE = 'Beware the weeping angel'
- self.config.UNICODE_VALUE = u'Québec'
self.config.DECIMAL_VALUE = Decimal('1.2')
self.config.DATETIME_VALUE = datetime(1977, 10, 2)
self.config.FLOAT_VALUE = 2.718281845905
@@ -49,10 +38,8 @@ class StorageTestsMixin(object):
# read again
self.assertEqual(self.config.INT_VALUE, 100)
- self.assertEqual(self.config.LONG_VALUE, long(654321))
self.assertEqual(self.config.BOOL_VALUE, False)
self.assertEqual(self.config.STRING_VALUE, 'Beware the weeping angel')
- self.assertEqual(self.config.UNICODE_VALUE, u'Québec')
self.assertEqual(self.config.DECIMAL_VALUE, Decimal('1.2'))
self.assertEqual(self.config.DATETIME_VALUE, datetime(1977, 10, 2))
self.assertEqual(self.config.FLOAT_VALUE, 2.718281845905)
@@ -75,19 +62,15 @@ class StorageTestsMixin(object):
def test_missing_values(self):
# set some values and leave out others
- self.config.LONG_VALUE = long(654321)
self.config.BOOL_VALUE = False
- self.config.UNICODE_VALUE = u'Québec'
self.config.DECIMAL_VALUE = Decimal('1.2')
self.config.DATETIME_VALUE = datetime(1977, 10, 2)
self.config.DATE_VALUE = date(2001, 12, 20)
self.config.TIME_VALUE = time(1, 59, 0)
self.assertEqual(self.config.INT_VALUE, 1) # this should be the default value
- self.assertEqual(self.config.LONG_VALUE, long(654321))
self.assertEqual(self.config.BOOL_VALUE, False)
self.assertEqual(self.config.STRING_VALUE, 'Hello world') # this should be the default value
- self.assertEqual(self.config.UNICODE_VALUE, u'Québec')
self.assertEqual(self.config.DECIMAL_VALUE, Decimal('1.2'))
self.assertEqual(self.config.DATETIME_VALUE, datetime(1977, 10, 2))
self.assertEqual(self.config.FLOAT_VALUE, 3.1415926536) # this should be the default value
diff --git a/tests/test_admin.py b/tests/test_admin.py
index 8a10feb..a26bb59 100644
--- a/tests/test_admin.py
+++ b/tests/test_admin.py
@@ -8,7 +8,6 @@ from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from django.template.defaultfilters import linebreaksbr
from django.test import TestCase, RequestFactory
-from django.utils import six
from constance import settings
from constance.admin import Config
@@ -18,7 +17,7 @@ class TestAdmin(TestCase):
model = Config
def setUp(self):
- super(TestAdmin, self).setUp()
+ super().setUp()
self.rf = RequestFactory()
self.superuser = User.objects.create_superuser('admin', 'nimda', 'a@a.cz')
self.normaluser = User.objects.create_user('normal', 'nimda', 'b@b.cz')
@@ -55,7 +54,7 @@ class TestAdmin(TestCase):
def test_str(self):
ct = ContentType.objects.get(app_label='constance', model='config')
- self.assertEqual(six.text_type(ct), 'config')
+ self.assertEqual(str(ct), 'config')
def test_linebreaks(self):
self.client.login(username='admin', password='nimda')
@@ -66,8 +65,8 @@ class TestAdmin(TestCase):
self.assertContains(response, linebreaksbr('eggs\neggs'))
@mock.patch('constance.settings.CONFIG_FIELDSETS', {
- 'Numbers': ('LONG_VALUE', 'INT_VALUE',),
- 'Text': ('STRING_VALUE', 'UNICODE_VALUE'),
+ 'Numbers': ('INT_VALUE',),
+ 'Text': ('STRING_VALUE',),
})
def test_fieldset_headers(self):
self.client.login(username='admin', password='nimda')
@@ -123,8 +122,8 @@ class TestAdmin(TestCase):
self.assertIsInstance(response, HttpResponseRedirect)
@mock.patch('constance.settings.CONFIG_FIELDSETS', {
- 'Numbers': ('LONG_VALUE', 'INT_VALUE',),
- 'Text': ('STRING_VALUE', 'UNICODE_VALUE'),
+ 'Numbers': ('INT_VALUE',),
+ 'Text': ('STRING_VALUE',),
})
def test_inconsistent_fieldset_submit(self):
"""
@@ -139,7 +138,7 @@ class TestAdmin(TestCase):
self.assertContains(response, 'is missing field(s)')
@mock.patch('constance.settings.CONFIG_FIELDSETS', {
- 'Numbers': ('LONG_VALUE', 'INT_VALUE',),
+ 'Fieldsets': ('STRING_VALUE', 'INT_VALUE',),
})
def test_fieldset_ordering_1(self):
"""Ordering of inner list should be preserved"""
@@ -148,14 +147,14 @@ class TestAdmin(TestCase):
request.user = self.superuser
response = self.options.changelist_view(request, {})
response.render()
- content_str = response.content.decode('utf-8')
+ content_str = response.content.decode()
self.assertGreater(
content_str.find('INT_VALUE'),
- content_str.find('LONG_VALUE')
+ content_str.find('STRING_VALUE')
)
@mock.patch('constance.settings.CONFIG_FIELDSETS', {
- 'Numbers': ('INT_VALUE', 'LONG_VALUE', ),
+ 'Fieldsets': ('INT_VALUE', 'STRING_VALUE',),
})
def test_fieldset_ordering_2(self):
"""Ordering of inner list should be preserved"""
@@ -164,9 +163,9 @@ class TestAdmin(TestCase):
request.user = self.superuser
response = self.options.changelist_view(request, {})
response.render()
- content_str = response.content.decode('utf-8')
+ content_str = response.content.decode()
self.assertGreater(
- content_str.find('LONG_VALUE'),
+ content_str.find('STRING_VALUE'),
content_str.find('INT_VALUE')
)
diff --git a/tests/test_checks.py b/tests/test_checks.py
index 0abc62e..7883a71 100644
--- a/tests/test_checks.py
+++ b/tests/test_checks.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
import datetime
from decimal import Decimal
import mock
diff --git a/tests/test_cli.py b/tests/test_cli.py
index f8220b6..ec00239 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
from datetime import datetime
from textwrap import dedent
@@ -8,7 +6,7 @@ from django.core.management import call_command, CommandError
from django.test import TransactionTestCase
from django.utils import timezone
from django.utils.encoding import smart_str
-from six import StringIO
+from io import StringIO
from constance import config
@@ -27,16 +25,14 @@ class CliTestCase(TransactionTestCase):
call_command('constance', 'list', stdout=self.out)
self.assertEqual(set(self.out.getvalue().splitlines()), set(dedent(smart_str(
-u""" BOOL_VALUE True
+""" BOOL_VALUE True
EMAIL_VALUE test@example.com
INT_VALUE 1
LINEBREAK_VALUE Spam spam
DATE_VALUE 2010-12-24
TIME_VALUE 23:59:59
TIMEDELTA_VALUE 1 day, 2:03:00
- LONG_VALUE 123456
STRING_VALUE Hello world
- UNICODE_VALUE Rivière-Bonjour რუსთაველი
CHOICE_VALUE yes
DECIMAL_VALUE 0.1
DATETIME_VALUE 2010-08-23 11:29:24
diff --git a/tests/test_database.py b/tests/test_database.py
index 281c506..2e937e5 100644
--- a/tests/test_database.py
+++ b/tests/test_database.py
@@ -9,7 +9,7 @@ class TestDatabase(StorageTestsMixin, TestCase):
def setUp(self):
self.old_backend = settings.BACKEND
settings.BACKEND = 'constance.backends.database.DatabaseBackend'
- super(TestDatabase, self).setUp()
+ super().setUp()
def test_database_queries(self):
# Read and set to default value
diff --git a/tests/test_form.py b/tests/test_form.py
index 0ccbde2..4016c86 100644
--- a/tests/test_form.py
+++ b/tests/test_form.py
@@ -10,10 +10,8 @@ class TestForm(TestCase):
f = ConstanceForm({})
self.assertIsInstance(f.fields['INT_VALUE'], fields.IntegerField)
- self.assertIsInstance(f.fields['LONG_VALUE'], fields.IntegerField)
self.assertIsInstance(f.fields['BOOL_VALUE'], fields.BooleanField)
self.assertIsInstance(f.fields['STRING_VALUE'], fields.CharField)
- self.assertIsInstance(f.fields['UNICODE_VALUE'], fields.CharField)
self.assertIsInstance(f.fields['DECIMAL_VALUE'], fields.DecimalField)
self.assertIsInstance(f.fields['DATETIME_VALUE'], fields.SplitDateTimeField)
self.assertIsInstance(f.fields['TIMEDELTA_VALUE'], fields.DurationField)
diff --git a/tests/test_redis.py b/tests/test_redis.py
index 973d52f..6f0b007 100644
--- a/tests/test_redis.py
+++ b/tests/test_redis.py
@@ -10,7 +10,7 @@ class TestRedis(StorageTestsMixin, TestCase):
def setUp(self):
self.old_backend = settings.BACKEND
settings.BACKEND = 'constance.backends.redisd.RedisBackend'
- super(TestRedis, self).setUp()
+ super().setUp()
self.config._backend._rd.clear()
def tearDown(self):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 2d6cfc4..a47b3e4 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
import datetime
from decimal import Decimal
@@ -31,7 +29,5 @@ class UtilsTestCase(TestCase):
'LINEBREAK_VALUE': 'Spam spam',
'DECIMAL_VALUE': Decimal('0.1'),
'STRING_VALUE': 'Hello world',
- 'UNICODE_VALUE': u'Rivière-Bonjour რუსთაველი',
'DATETIME_VALUE': datetime.datetime(2010, 8, 23, 11, 29, 24),
- 'LONG_VALUE': 123456
})
diff --git a/tox.ini b/tox.ini
index 64f707d..ce609f7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,9 +1,8 @@
[tox]
envlist =
- py{27,35,36,37,py,py3}-django-111
- py{35,36,37,py3}-django-21
- py{37}-django-22
- py{37}-django-master
+ py{35,36,37,pypy3}-django{22}
+ py{36,37,38}-django{30}
+ py{36,37,38}-django-master
[testenv]
deps =
@@ -11,10 +10,8 @@ deps =
coverage
mock
django-picklefield
- django-111: Django>=1.11,<2.0
- django-20: Django>=2.0,<2.1
- django-21: Django>=2.1,<2.2
- django-22: Django>=2.2b1,<2.3
+ django-22: Django>=2.2,<3.0
+ django-30: Django>=3.0,<3.1
django-master: https://github.com/django/django/archive/master.tar.gz
usedevelop = True
ignore_outcome =