From d9fb4f916783de841ea43a3d953bf8512f1ec9b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89loi=20Rivard?= <eloi@yaal.coop>
Date: Sat, 11 Nov 2023 11:32:19 +0100
Subject: [PATCH] chore: support for python 3.12

---
 .github/workflows/test-docs.yml | 7 +++++--
 CHANGELOG.md                    | 2 +-
 README.md                       | 2 +-
 docs/installation.md            | 2 +-
 ihatemoney/tests/api_test.py    | 2 +-
 ihatemoney/tests/budget_test.py | 4 ++--
 pyproject.toml                  | 1 +
 tox.ini                         | 2 +-
 8 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml
index dfdc83760..dfcc13ffe 100644
--- a/.github/workflows/test-docs.yml
+++ b/.github/workflows/test-docs.yml
@@ -36,7 +36,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
+        python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
         dependencies: [normal]
         database: [sqlite]
         # Test other databases only with one version of Python (Debian buster has 3.7)
@@ -66,6 +66,9 @@ jobs:
           - python-version: "3.11"
             dependencies: minimal
             database: sqlite
+          - python-version: "3.12"
+            dependencies: minimal
+            database: sqlite
 
     steps:
     - uses: actions/checkout@v3
@@ -100,4 +103,4 @@ jobs:
         TESTING_SQLALCHEMY_DATABASE_URI: 'mysql+pymysql://root:ihatemoney@localhost:3306/ihatemoney_ci'
     - name: Run Lint & Docs
       run: tox -e lint_docs
-      if: matrix.python-version == '3.11'
+      if: matrix.python-version == '3.12'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e32bc7ded..7edae7291 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@ This document describes changes between each past release.
 ## 6.1.2 (unreleased)
 
 
-- Nothing changed yet.
+- Add support for python 3.12 (#757)
 
 
 ## 6.1.1 (2023-10-04)
diff --git a/README.md b/README.md
index ff4cdf67a..f6d3759e7 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ highly encouraged to do so.
 
 ## Requirements
 
--   **Python**: version 3.7 to 3.11.
+-   **Python**: version 3.7 to 3.12.
 -   **Backends**: SQLite, PostgreSQL, MariaDB (version 10.3.2 or above),
     Memory.
 
diff --git a/docs/installation.md b/docs/installation.md
index 8cd884291..d0cae4488 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -83,7 +83,7 @@ Some Paas (Platform-as-a-Service), provide a documentation or even a quick insta
 
 «Ihatemoney» depends on:
 
--   **Python**: any version from 3.7 to 3.11 will work.
+-   **Python**: any version from 3.7 to 3.12 will work.
 -   **A database backend**: choose among SQLite, PostgreSQL, MariaDB (>=
     10.3.2).
 -   **Virtual environment** (recommended): [python3-venv]{.title-ref}
diff --git a/ihatemoney/tests/api_test.py b/ihatemoney/tests/api_test.py
index 9d70e8e69..fe5504506 100644
--- a/ihatemoney/tests/api_test.py
+++ b/ihatemoney/tests/api_test.py
@@ -43,7 +43,7 @@ def api_add_member(self, project, name, weight=1):
     def get_auth(self, username, password=None):
         password = password or username
         base64string = (
-            base64.encodebytes(f"{username}:{password}".encode("utf-8"))
+            base64.encodebytes(f"{username}:{password}".encode("utf-8"))  # noqa: E231
             .decode("utf-8")
             .replace("\n", "")
         )
diff --git a/ihatemoney/tests/budget_test.py b/ihatemoney/tests/budget_test.py
index 7c6c55d8f..eba269fd2 100644
--- a/ihatemoney/tests/budget_test.py
+++ b/ihatemoney/tests/budget_test.py
@@ -1781,7 +1781,7 @@ def test_rss_feed(self):
             <pubDate>Tue, 25 Jul 2023 00:00:00 +0000</pubDate>
         </item>
         </channel>
-</rss>"""  # noqa: E501
+</rss>"""  # noqa: E221, E222, E231, E501
         assert resp.data.decode() == expected_rss_content
 
     def test_rss_feed_history_disabled(self):
@@ -1865,7 +1865,7 @@ def test_rss_feed_history_disabled(self):
             <pubDate>Tue, 25 Jul 2023 00:00:00 +0000</pubDate>
         </item>
         </channel>
-</rss>"""  # noqa: E501
+</rss>"""  # noqa: E221, E222, E231, E501
         assert resp.data.decode() == expected_rss_content
 
     def test_rss_if_modified_since_header(self):
diff --git a/pyproject.toml b/pyproject.toml
index b38c68b62..232233400 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -20,6 +20,7 @@ classifiers = [
     "Programming Language :: Python :: 3.9",
     "Programming Language :: Python :: 3.10",
     "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
     "Topic :: Internet :: WWW/HTTP",
     "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
 ]
diff --git a/tox.ini b/tox.ini
index e79ede311..695d550c8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py311,py310,py39,py38,py37,lint_docs
+envlist = py312,py311,py310,py39,py38,py37,lint_docs
 skip_missing_interpreters = True
 
 [testenv]