Skip to content

Commit

Permalink
Update tests and tidy up old code (#100)
Browse files Browse the repository at this point in the history
* Drop soon to be EOL python 3.9 and django versions
* Bump workflow actions
* Update target python versions for django main (6.0)
* Use python 3 strings and objects
* Add back python 3.9 to tests
* Pre-emptively add Django 5.2 to classifiers list
* Run flake8 tests on python 3.13
* Remove check for importlib as supported from python 3.3
* Remove blank line from start of sphinx config file
* Tidy up whitespace
* Fix flake8 test
  • Loading branch information
mikemanger authored Feb 13, 2025
1 parent bcb3ba4 commit 211235f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 39 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -38,4 +37,4 @@ jobs:
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)

- name: codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
6 changes: 3 additions & 3 deletions appconf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .utils import import_attribute


class AppConfOptions(object):
class AppConfOptions:

def __init__(self, meta, prefix=None):
self.prefix = prefix
Expand All @@ -18,7 +18,7 @@ def __init__(self, meta, prefix=None):
def prefixed_name(self, name):
if name.startswith(self.prefix.upper()):
return name
return "%s_%s" % (self.prefix.upper(), name.upper())
return "{}_{}".format(self.prefix.upper(), name.upper())

def contribute_to_class(self, cls, name):
cls._meta = self
Expand All @@ -29,7 +29,7 @@ def contribute_to_class(self, cls, name):
class AppConfMetaClass(type):

def __new__(cls, name, bases, attrs):
super_new = super(AppConfMetaClass, cls).__new__
super_new = super().__new__
parents = [b for b in bases if isinstance(b, AppConfMetaClass)]
if not parents:
return super_new(cls, name, bases, attrs)
Expand Down
5 changes: 1 addition & 4 deletions appconf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@


def import_attribute(import_path, exception_handler=None):
try:
from importlib import import_module
except ImportError: # pragma: no cover
from django.utils.importlib import import_module
from importlib import import_module
module_name, object_name = import_path.rsplit('.', 1)
try:
module = import_module(module_name)
Expand Down
14 changes: 6 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# django-appconf documentation build configuration file, created by
# sphinx-quickstart on Thu Aug 25 14:26:22 2011.
#
Expand Down Expand Up @@ -40,8 +38,8 @@
master_doc = 'index'

# General information about the project.
project = u'django-appconf'
copyright = u'2011-2013, Jannis Leidel and individual contributors'
project = 'django-appconf'
copyright = '2011-2013, Jannis Leidel and individual contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -182,8 +180,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'django-appconf.tex', u'django-appconf Documentation',
u'Jannis Leidel and individual contributors', 'manual'),
('index', 'django-appconf.tex', 'django-appconf Documentation',
'Jannis Leidel and individual contributors', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -215,8 +213,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'django-appconf', u'django-appconf Documentation',
[u'Jannis Leidel and individual contributors'], 1)
('index', 'django-appconf', 'django-appconf Documentation',
['Jannis Leidel and individual contributors'], 1)
]


Expand Down
10 changes: 3 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,24 @@ def find_version(*parts):
license='BSD',
url='https://django-appconf.readthedocs.io/',
packages=['appconf'],
python_requires='>=3.7',
python_requires='>=3.9',
install_requires=['django'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django :: 5.1',
'Framework :: Django :: 5.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Utilities',
],
Expand Down
2 changes: 1 addition & 1 deletion tests/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from appconf import AppConf


class CustomHolder(object):
class CustomHolder:
HOLDER_VALUE = True

custom_holder = CustomHolder()
Expand Down
19 changes: 8 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
[tox]
envlist =
flake8-py311,
py{37,38,39,310}-dj32
py{38,39,310,311}-dj{40,41,42}
py{310,311,312}-dj{50,51,main}
flake8-py313,
py{39,310,311,312}-dj42
py{310,311,312,313}-dj{51,52}
py{312,313}-djmain

[testenv]
usedevelop = true
setenv =
PYTHONPATH = {toxinidir}
DJANGO_SETTINGS_MODULE=tests.test_settings
deps =
py{37,38,39,310,311,312}: coverage
py{39,310,311,312,313}: coverage
django-discover-runner
dj32: Django>=3.2,<4.0
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2a1,<4.3
dj50: Django>=5.0b1,<5.1
dj42: Django>=4.2,<4.3
dj51: Django>=5.1,<5.2
dj52: Django>=5.2a1,<5.3
djmain: https://github.com/django/django/archive/main.tar.gz#egg=django

commands =
coverage run {envbindir}/django-admin test -v2 {posargs:tests}
coverage report

[testenv:flake8-py311]
[testenv:flake8-py313]
commands = flake8 appconf
deps = flake8

Expand Down

0 comments on commit 211235f

Please # to comment.