From 9173bea9a0dd0d5e1531a59b055ce21570f72389 Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Thu, 15 Oct 2026 16:06:18 +0200 Subject: [PATCH 1/2] fix(ci): satisfy lint and Python 3.10 test imports Narrow expected input and report errors, format test imports and use pytest-provided tomli on Python3.10. Keep lint rules and assertions intact. Generated-with: gpt-6.1-sol --- CHANGELOG.md | 4 ++++ MethodenAnalyser3.py | 2 +- manage_translations.py | 4 ++-- tests/test_app_assets.py | 2 +- tests/test_security_license_contract.py | 6 +++++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0692711..47e730d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.1.0/). ## [Unreleased] +### CI-Lint und Python-3.10-Vertragstests (2026-10-15) +- Die Fehlerbehandlung beim Laden von Übersetzungen und beim Speichern von Berichten auf erwartete Datei-, Daten- und Tk-Fehler begrenzt. Die bestehenden Ruff-Regeln bleiben aktiviert. +- Importreihenfolge und einen überflüssigen Encoding-Header in zwei Testmodulen korrigiert. Der TOML-Vertragstest verwendet unter Python 3.10 den bereits von pytest benötigten `tomli`-Parser. + ### CLI Windows cp1252-Resilienz & Tier-2 Translations-Paritäts-Tooling (2026-10-09) - **Windows cp1252 CLI Encoding-Resilienz (`MethodenAnalyser3.py`)**: - `generate_report`: Unicode-Pfeil `\u2192` (`→`) bei der Ausgabe ähnlicher Namens-Matches (`name_matches`) durch ASCII-Pfeil `->` ersetzt. Behebt `BS-02-BACKLOG` und schließt `UnicodeEncodeError: 'charmap' codec can't encode character '\u2192'` auf Windows-Konsolen mit Standard-Codepage cp1252 zuverlässig aus. diff --git a/MethodenAnalyser3.py b/MethodenAnalyser3.py index 7adc528..21c5820 100644 --- a/MethodenAnalyser3.py +++ b/MethodenAnalyser3.py @@ -2382,7 +2382,7 @@ def save_report_as(output_widget: scrolledtext.ScrolledText, status_widget: tk.L if status_widget is not None: status_widget.config(text=f"{_t('status_report_saved')} {os.path.basename(file_path)}") messagebox.showinfo(_t("dialog_success_title"), f"{_t('status_report_saved')} {file_path}") - except Exception as e: + except (OSError, ValueError, tk.TclError) as e: if status_widget is not None: status_widget.config(text=f"[FEHLER] {e}") messagebox.showerror(_t("dialog_error_title"), str(e)) diff --git a/manage_translations.py b/manage_translations.py index 593a0a9..87ca823 100644 --- a/manage_translations.py +++ b/manage_translations.py @@ -73,7 +73,7 @@ def check_translations(source_dir="."): try: with open(trans_file, "r", encoding="utf-8") as f: translations = json.load(f) - except Exception as e: + except (OSError, ValueError) as e: print(f"[!] Fehler beim Laden von {trans_file}: {e}") return False @@ -114,7 +114,7 @@ def show_stats(source_dir="."): try: with open(trans_file, "r", encoding="utf-8") as f: translations = json.load(f) - except Exception as e: + except (OSError, ValueError) as e: print(f"[!] Fehler beim Laden von {trans_file}: {e}") return diff --git a/tests/test_app_assets.py b/tests/test_app_assets.py index 12b17fe..0eb3dfa 100644 --- a/tests/test_app_assets.py +++ b/tests/test_app_assets.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- """Test suite for application icon assets, store logos and PWA manifests.""" import json from pathlib import Path + from PIL import Image ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_security_license_contract.py b/tests/test_security_license_contract.py index 792cbbb..795044f 100644 --- a/tests/test_security_license_contract.py +++ b/tests/test_security_license_contract.py @@ -4,9 +4,13 @@ import ast import re -import tomllib from pathlib import Path +try: + import tomllib +except ModuleNotFoundError: # Python 3.10; supplied by pytest's test dependencies. + import tomli as tomllib + ROOT = Path(__file__).resolve().parents[1] From 87eff55da8b10fcb5bab307a72bb2f5e2f9e889c Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Thu, 15 Oct 2026 16:10:20 +0200 Subject: [PATCH 2/2] fix(ci): install declared image-test dependency Keep Pillow in dev/test tooling and install it before asset-test collection; runtime dependencies remain empty. Generated-with: gpt-6.1-sol --- .github/workflows/tests.yml | 2 +- CHANGELOG.md | 1 + pyproject.toml | 1 + requirements-dev.txt | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 18a6e2a..1f4576a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -59,7 +59,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install pytest ruff + pip install pytest ruff "Pillow>=12.3.0" - name: Run Ruff Lint Check run: ruff check . diff --git a/CHANGELOG.md b/CHANGELOG.md index 47e730d..11624d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.1.0/). ### CI-Lint und Python-3.10-Vertragstests (2026-10-15) - Die Fehlerbehandlung beim Laden von Übersetzungen und beim Speichern von Berichten auf erwartete Datei-, Daten- und Tk-Fehler begrenzt. Die bestehenden Ruff-Regeln bleiben aktiviert. - Importreihenfolge und einen überflüssigen Encoding-Header in zwei Testmodulen korrigiert. Der TOML-Vertragstest verwendet unter Python 3.10 den bereits von pytest benötigten `tomli`-Parser. +- Pillow als reine Entwicklungs-/Testabhängigkeit für die Bildprüfungen deklariert und im CI-Installationsschritt ergänzt; die Anwendung selbst benötigt weiterhin nur die Standardbibliothek. ### CLI Windows cp1252-Resilienz & Tier-2 Translations-Paritäts-Tooling (2026-10-09) - **Windows cp1252 CLI Encoding-Resilienz (`MethodenAnalyser3.py`)**: diff --git a/pyproject.toml b/pyproject.toml index f128ac7..ebcb013 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,7 @@ Support = "mailto:support@lukasgeiger.com" dev = [ "pytest>=9.1.1", "ruff>=0.9.0", + "Pillow>=12.3.0", ] build = [ "pyinstaller>=6.10.0", diff --git a/requirements-dev.txt b/requirements-dev.txt index e178712..6b71984 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,6 +2,7 @@ # Tested toolchain range (runtime remains Python standard library only). pytest>=9.1.1,<10.0 ruff>=0.9.0 +Pillow>=12.3.0 pyinstaller>=6.14.2,<7.0 altgraph>=0.17.4 packaging>=24.0