Skip to content

Commit a240028

Browse files
committed
drop Python 3.9, Django 2.2. Add Python 3.14
1 parent c612c66 commit a240028

File tree

6 files changed

+29
-53
lines changed

6 files changed

+29
-53
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ jobs:
4141
python-version:
4242
# When changing this list, be sure to check the [gh-actions] list in
4343
# tox.ini so that tox will run properly.
44-
- "3.9"
4544
- "3.10"
4645
- "3.11"
4746
- "3.12"
4847
- "3.13"
48+
- "3.14"
4949
fail-fast: false
5050

5151
steps:
@@ -94,7 +94,7 @@ jobs:
9494
- name: "Set up Python"
9595
uses: "actions/setup-python@v5"
9696
with:
97-
python-version: "3.9"
97+
python-version: "3.10"
9898

9999
- name: "Install dependencies"
100100
run: |

README.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ A `coverage.py`_ plugin to measure test coverage of Django templates.
2020
.. |versions| image:: https://img.shields.io/pypi/pyversions/django_coverage_plugin.svg
2121
:target: https://pypi.python.org/pypi/django_coverage_plugin
2222
:alt: Supported Python Versions
23-
.. the Django badge says: `2.2 | 3.2 | 4.2 | 5.2`
24-
.. |djversions| image:: https://img.shields.io/badge/Django-2.2%20%7C%203.2%20%7C%204.2%20%7C%205.2-44b78b.svg
23+
.. the Django badge says: `3.2 | 4.2 | 5.2`
24+
.. |djversions| image:: https://img.shields.io/badge/Django-3.2%20%7C%204.2%20%7C%205.2-44b78b.svg
2525
:target: https://pypi.python.org/pypi/django_coverage_plugin
2626
:alt: Supported Django Versions
2727
.. |sponsor| image:: https://img.shields.io/badge/%E2%9D%A4-Sponsor%20me-brightgreen?style=flat&logo=GitHub
@@ -38,9 +38,9 @@ A `coverage.py`_ plugin to measure test coverage of Django templates.
3838

3939
Supported on:
4040

41-
- Python: 3.9 through 3.13.
41+
- Python: 3.10 through 3.14.
4242

43-
- Django: 2.2 through 5.2.
43+
- Django: 3.2 through 5.2.
4444

4545
- Coverage.py: 6.x or higher.
4646

@@ -143,6 +143,12 @@ History
143143

144144
.. scriv-insert-here
145145
146+
v3.2.0 — 2025-10-05
147+
-------------------
148+
149+
Drop Python 3.9 and Django 2.2. Add Python 3.14.
150+
151+
146152
v3.1.1 — 2025-06-15
147153
-------------------
148154

django_coverage_plugin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"""Django Template Coverage Plugin"""
55

6-
__version__ = "3.1.1"
6+
__version__ = "3.2.0"
77

88
from .plugin import DjangoTemplatePluginException # noqa
99
from .plugin import DjangoTemplatePlugin

django_coverage_plugin/plugin.py

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,14 @@
66
import os.path
77
import re
88

9-
try:
10-
from coverage.exceptions import NoSource
11-
except ImportError:
12-
# for coverage 5.x
13-
from coverage.misc import NoSource
149
import coverage.plugin
1510
import django
1611
import django.template
17-
from django.template.base import Lexer, NodeList, Template, TextNode
12+
from coverage.exceptions import NoSource
13+
from django.template.base import Lexer, NodeList, Template, TextNode, TokenType
1814
from django.template.defaulttags import VerbatimNode
1915
from django.templatetags.i18n import BlockTranslateNode
2016

21-
try:
22-
from django.template.base import TokenType
23-
24-
def _token_name(token_type):
25-
token_type.name.capitalize()
26-
27-
except ImportError:
28-
# Django <2.1 uses separate constants for token types
29-
from django.template.base import (
30-
TOKEN_BLOCK,
31-
TOKEN_MAPPING,
32-
TOKEN_TEXT,
33-
TOKEN_VAR,
34-
)
35-
36-
class TokenType:
37-
TEXT = TOKEN_TEXT
38-
VAR = TOKEN_VAR
39-
BLOCK = TOKEN_BLOCK
40-
41-
def _token_name(token_type):
42-
return TOKEN_MAPPING[token_type]
43-
4417

4518
class DjangoTemplatePluginException(Exception):
4619
"""Used for any errors from the plugin itself."""
@@ -96,8 +69,8 @@ def check_debug():
9669
return True
9770

9871

99-
if django.VERSION < (2, 0):
100-
raise RuntimeError("Django Coverage Plugin requires Django 2.x or higher")
72+
if django.VERSION < (3, 0):
73+
raise RuntimeError("Django Coverage Plugin requires Django 3.x or higher")
10174

10275

10376
# Since we are grabbing at internal details, we have to adapt as they
@@ -129,14 +102,8 @@ def read_template_source(filename):
129102
if not settings.configured:
130103
settings.configure()
131104

132-
with open(filename, "rb") as f:
133-
# The FILE_CHARSET setting will be removed in 3.1:
134-
# https://docs.djangoproject.com/en/3.0/ref/settings/#file-charset
135-
if django.VERSION >= (3, 1):
136-
charset = 'utf-8'
137-
else:
138-
charset = settings.FILE_CHARSET
139-
text = f.read().decode(charset)
105+
with open(filename, "r", encoding="utf-8") as f:
106+
text = f.read()
140107

141108
return text
142109

@@ -326,7 +293,7 @@ def lines(self):
326293
if SHOW_PARSING:
327294
print(
328295
"%10s %2d: %r" % (
329-
_token_name(token.token_type),
296+
token.token_type.capitalize(),
330297
token.lineno,
331298
token.contents,
332299
)

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,22 @@ classifiers = [
1717
"Development Status :: 5 - Production/Stable",
1818
"Environment :: Console",
1919
"Framework :: Django",
20-
"Framework :: Django :: 2.2",
2120
"Framework :: Django :: 3.2",
2221
"Framework :: Django :: 4.2",
2322
"Framework :: Django :: 5.2",
2423
"Intended Audience :: Developers",
2524
"Operating System :: OS Independent",
26-
"Programming Language :: Python :: 3.9",
2725
"Programming Language :: Python :: 3.10",
2826
"Programming Language :: Python :: 3.11",
2927
"Programming Language :: Python :: 3.12",
3028
"Programming Language :: Python :: 3.13",
29+
"Programming Language :: Python :: 3.14",
3130
"Programming Language :: Python :: Implementation :: CPython",
3231
"Programming Language :: Python :: Implementation :: PyPy",
3332
"Topic :: Software Development :: Quality Assurance",
3433
"Topic :: Software Development :: Testing",
3534
]
36-
requires-python = ">= 3.9"
35+
requires-python = ">= 3.10"
3736
dependencies = [
3837
"coverage",
3938
"Django",

tox.ini

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@
1515
[tox]
1616
# When changing this, also update the classifiers in setup.py:
1717
envlist =
18-
py39-django{22,32,42}-cov{6,7,tip},
1918
py310-django{32,42,52}-cov{6,7,tip},
2019
py311-django{42,52}-cov{6,7,tip},
2120
py312-django{52,tip}-cov{7,tip},
2221
py313-django{52,tip}-cov{7,tip},
22+
py314-django{52,tip}-cov{7,tip},
2323
check,pkgcheck,doc
2424

2525
[testenv]
2626
deps =
2727
cov6: coverage>=6.0,<7.0
2828
cov7: coverage>=7.0,<8.0
2929
covtip: git+https://github.com/nedbat/coveragepy.git
30-
django22: Django>=2.2,<3.0
3130
django32: Django>=3.2,<4.0
3231
django42: Django>=4.2,<5.0
3332
django52: Django>=5.2,<6.0
@@ -43,6 +42,11 @@ usedevelop = True
4342

4443
passenv = *
4544

45+
setenv =
46+
# In later versions of Python, the default coverage.py core is sysmon,
47+
# which doesn't support plugins like us. Force ctrace instead.
48+
py3{12,13,14}: COVERAGE_CORE=ctrace
49+
4650
[testenv:check]
4751
deps =
4852
flake8
@@ -75,8 +79,8 @@ commands =
7579

7680
[gh-actions]
7781
python =
78-
3.9: py39
7982
3.10: py310
8083
3.11: py311
8184
3.12: py312
8285
3.13: py313
86+
3.14: py314

0 commit comments

Comments
 (0)