Repository: mozilla/bleach (language: python)

Issue:
feature: add support for Python 3.12
Add support for Python 3.12 which will come out beginning of October 2023.


Discussion / hints:

Fix patch:
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 12a51fe8..12078b07 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,13 +1,14 @@
 -e .
 
-black==22.12.0; implementation_name == 'cpython'
-build==0.10.0
-mypy==0.991; implementation_name =='cpython'
-pytest==7.2.1
-tox==4.3.5
-tox-gh-actions==3.0.0
+black==23.9.1; implementation_name == 'cpython'
+build==1.0.3
+mypy==1.5.1; implementation_name =='cpython'
+pytest==7.4.2
+setuptools==68.2.2
+tox==4.11.3
+tox-gh-actions==3.1.3
 twine==4.0.2
-wheel==0.38.4
+wheel==0.41.2
 
 # NOTE(willkg): Held back until we drop support for Python 3.7
 Sphinx==5.3.0
diff --git a/tox.ini b/tox.ini
index 95de9f43..5c409331 100644
--- a/tox.ini
+++ b/tox.ini
@@ -2,9 +2,9 @@
 
 [tox]
 envlist =
-    py{38,39,310,311,py3}
-    py{38,39,310,311,py3}-tinycss2
-    py{38,39,310,311}-build-no-lang
+    py{38,39,310,311,312,py3}
+    py{38,39,310,311,312,py3}-tinycss2
+    py{38,39,310,311,312}-build-no-lang
     py39-docs
     py39-format-check
     py39-lint
@@ -16,6 +16,7 @@ python =
     3.9: py39
     3.10: py310
     3.11: py311
+    3.12: py312
     pypy-3.8: pypy3
 
 [testenv]
@@ -48,6 +49,12 @@ extras = css
 commands =
     pytest {posargs:-v}
 
+[testenv:py312-tinycss2]
+deps = -rrequirements-dev.txt
+extras = css
+commands =
+    pytest {posargs:-v}
+
 [testenv:pypy3-tinycss2]
 deps = -rrequirements-dev.txt
 extras = css
@@ -78,6 +85,12 @@ setenv =
 commands =
     python setup.py build
 
+[testenv:py312-build-no-lang]
+setenv =
+    LANG=
+commands =
+    python setup.py build
+
 [testenv:py39-lint]
 changedir = {toxinidir}
 deps = -rrequirements-flake8.txt


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e16ff30c..e8328847 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,7 +9,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.8"]
+        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8"]
         os: [ubuntu-latest, macos-latest, windows-latest]
 
     steps:
diff --git a/tests/test_parse_shim.py b/tests/test_parse_shim.py
index f49a6435..48ff0fdf 100644
--- a/tests/test_parse_shim.py
+++ b/tests/test_parse_shim.py
@@ -95,7 +95,6 @@ class ParseResult:
     ],
 )
 def test_urlparse(uri, expected):
-
     if inspect.isclass(expected) and issubclass(expected, BaseException):
         with pytest.raises(expected):
             urlparse(uri)
diff --git a/tests_website/server.py b/tests_website/server.py
index 0f0ed740..de6c8770 100755
--- a/tests_website/server.py
+++ b/tests_website/server.py
@@ -20,7 +20,6 @@
 
 
 class BleachCleanHandler(http.server.SimpleHTTPRequestHandler):
-
     # Prevent 'cannot bind to address' errors on restart
     allow_reuse_address = True