diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7a2d333..c2e8801 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,7 +67,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 da791bf..c082175 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.1.0/). ## [Unreleased] +### CI-Korrektur: Lint- und Testlauf auf `master` wiederhergestellt (2026-11-11) +- **Ruff**: 23 Befunde behoben, an denen alle 12 Matrixjobs vor dem Testschritt scheiterten. Fehlerbehandlungen in `MethodenAnalyser3.py`, `manage_translations.py`, `scripts/check_store_readiness.py` und `scripts/run_windows_wack.py` fangen jetzt die erwarteten Datei-, Daten-, XML- und Tk-Fehler statt pauschal `Exception`. Keine Lint-Regel wurde abgeschaltet. +- **Python 3.10**: `tests/test_security_license_contract.py` und `scripts/check_store_readiness.py` fallen auf `tomli` zurück, weil `tomllib` erst ab Python 3.11 zur Standardbibliothek gehört. +- **Pillow**: als Entwicklungs- und CI-Abhängigkeit erklärt (`pyproject.toml`, `requirements-dev.txt`, `tests.yml`); `tests/test_app_assets.py` importiert `PIL`. Die Laufzeit bleibt ohne externe Pakete. +- **WACK-Preflight**: Zeitstempel im Report tragen jetzt den lokalen UTC-Versatz. + ### Windows Store Packaging & Tier-2 6-Sprachen-Harmonisierung nach Policy P-006 (2026-11-07) - **Store-Packaging & Manifest-Harmonisierung (`store_package.json`, `releases/windowsstore/store_settings.json`)**: - Vollständige Tier-2 6-Sprachen-Harmonisierung (`de-DE`, `en-US`, `es-ES`, `zh-CN`, `ja-JP`, `ru-RU`). diff --git a/MethodenAnalyser3.py b/MethodenAnalyser3.py index e753393..3b7999a 100644 --- a/MethodenAnalyser3.py +++ b/MethodenAnalyser3.py @@ -2404,7 +2404,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 95cca2c..fa9a68e 100644 --- a/manage_translations.py +++ b/manage_translations.py @@ -22,7 +22,7 @@ sys.stdout.reconfigure(encoding="utf-8", errors="replace") if hasattr(sys.stderr, "reconfigure"): sys.stderr.reconfigure(encoding="utf-8", errors="replace") - except Exception: + except (OSError, ValueError): pass APP_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -85,7 +85,7 @@ def check_translations(source_dir=None): 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 @@ -128,7 +128,7 @@ def show_stats(source_dir=None): 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 @@ -155,7 +155,7 @@ def save_translations(trans_file, translations): os.fsync(f.fileno()) os.replace(temp_file, trans_file) return True - except Exception as e: + except (OSError, TypeError, ValueError) as e: if os.path.exists(temp_file): try: os.remove(temp_file) diff --git a/pyproject.toml b/pyproject.toml index d7cc26d..7577bba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,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 diff --git a/scripts/check_store_readiness.py b/scripts/check_store_readiness.py index e99ca8f..99bebf5 100644 --- a/scripts/check_store_readiness.py +++ b/scripts/check_store_readiness.py @@ -9,12 +9,15 @@ import argparse import json import re -import tomllib +import xml.etree.ElementTree as ET import zipfile +from collections.abc import Sequence from pathlib import Path -from typing import Sequence -import xml.etree.ElementTree as ET +try: + import tomllib +except ModuleNotFoundError: # Python 3.10: tomli is installed alongside pytest + import tomli as tomllib REQUIRED_DOCUMENTS = ( "PRIVACY_POLICY.md", @@ -114,10 +117,7 @@ def _check_repository(project_root: Path) -> list[str]: ) capabilities = config.get("capabilities") - if isinstance(capabilities, list): - if "runFullTrust" not in capabilities: - findings.append("[repository] store_package.json must declare runFullTrust") - elif isinstance(capabilities, str): + if isinstance(capabilities, (list, str)): if "runFullTrust" not in capabilities: findings.append("[repository] store_package.json must declare runFullTrust") else: @@ -184,7 +184,7 @@ def _check_repository(project_root: Path) -> list[str]: findings.append( f"[repository] AppxManifest.xml missing resource languages: {expected_manifest_langs - manifest_langs}" ) - except Exception as exc: + except (OSError, ET.ParseError) as exc: findings.append(f"[repository] AppxManifest.xml parse error: {exc}") # Check tile icons in store_package/MethodenAnalyser/icons/ @@ -266,8 +266,10 @@ def _check_repository(project_root: Path) -> list[str]: def _check_evidence(evidence_root: Path | None) -> list[str]: if evidence_root is None: return [ - "[external] evidence root was not supplied (Partner Center reservation, FullTrust review, " - "Windows tray smoke, live URL readback, SBOM, signed MSIX/hash, and WACK PASS remain open)" + ( + "[external] evidence root was not supplied (Partner Center reservation, FullTrust review, " + "Windows tray smoke, live URL readback, SBOM, signed MSIX/hash, and WACK PASS remain open)" + ) ] if not evidence_root.is_dir(): return [f"[external] evidence root does not exist: {evidence_root}"] diff --git a/scripts/run_windows_wack.py b/scripts/run_windows_wack.py index 2a4c732..b9205aa 100644 --- a/scripts/run_windows_wack.py +++ b/scripts/run_windows_wack.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 """run_windows_wack.py - Führt das Windows App Certification Kit (WACK) für MethodenAnalyser aus oder erstellt hermetische Preflight-Reports.""" from __future__ import annotations @@ -81,7 +80,7 @@ def resolve_report_path(project_root: Path, report_dir: Path | None, explicit: P if explicit is not None: return explicit.expanduser().resolve() base_dir = (report_dir or (project_root / "releases" / "windowsstore" / "test_reports")).expanduser().resolve() - timestamp = datetime.now().strftime("%Y%m%d") + timestamp = datetime.now().astimezone().strftime("%Y%m%d") return base_dir / f"{WACK_REPORT_PREFIX}{timestamp}.xml" @@ -100,7 +99,7 @@ def is_windows_admin() -> bool: return False try: return bool(ctypes.windll.shell32.IsUserAnAdmin()) - except Exception: + except (AttributeError, OSError): return False @@ -163,7 +162,7 @@ def run_preflight_checks(project_root: Path, store_config: dict[str, object]) -> "result": "FAIL", "details": "Properties Logo-Element fehlt im Manifest", }) - except Exception as e: + except (OSError, ET.ParseError) as e: checks.append({ "id": "MANIFEST_SYNTAX", "name": "AppxManifest-Validierung & XML-Wohlgeformtheit", @@ -302,7 +301,7 @@ def write_xml_report(path: Path, checks: list[dict[str, object]]) -> WackSummary root = ET.Element("REPORT", { "TOOL": "WACK-Preflight-Runner", "VERSION": "1.0.0", - "TIMESTAMP": datetime.now().isoformat(), + "TIMESTAMP": datetime.now().astimezone().isoformat(), }) summary_elem = ET.SubElement(root, "SUMMARY") passes = sum(1 for c in checks if c["result"] == "PASS") diff --git a/tests/source_platform_smoke.py b/tests/source_platform_smoke.py index 22ef160..ba1e5c2 100644 --- a/tests/source_platform_smoke.py +++ b/tests/source_platform_smoke.py @@ -17,7 +17,6 @@ import MethodenAnalyser3 as m from translator import TranslationSystem - ROOT = Path(__file__).resolve().parents[1] 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_bugsweep_scope_hierarchy_and_export_resilience_20261030.py b/tests/test_bugsweep_scope_hierarchy_and_export_resilience_20261030.py index dc518cf..224b661 100644 --- a/tests/test_bugsweep_scope_hierarchy_and_export_resilience_20261030.py +++ b/tests/test_bugsweep_scope_hierarchy_and_export_resilience_20261030.py @@ -138,6 +138,7 @@ def test_manage_translations_check_outside_repo_cwd(): [sys.executable, str(manage_py), "--check"], cwd=foreign_cwd, capture_output=True, + check=False, text=True, ) assert res.returncode == 0, f"Fehler bei fremdem CWD: {res.stdout}\n{res.stderr}" diff --git a/tests/test_manage_translations_atomic_write_and_stream.py b/tests/test_manage_translations_atomic_write_and_stream.py index 8e0a32f..bec5a91 100644 --- a/tests/test_manage_translations_atomic_write_and_stream.py +++ b/tests/test_manage_translations_atomic_write_and_stream.py @@ -12,7 +12,7 @@ ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT)) -import manage_translations as mt # noqa: E402 +import manage_translations as mt def test_save_translations_atomic_write_creates_valid_json(tmp_path): diff --git a/tests/test_security_license_contract.py b/tests/test_security_license_contract.py index 792cbbb..e34b277 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: tomli is installed alongside pytest + import tomli as tomllib + ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_store_materials.py b/tests/test_store_materials.py index dd6a2f4..953e8a0 100644 --- a/tests/test_store_materials.py +++ b/tests/test_store_materials.py @@ -3,9 +3,8 @@ import json import subprocess import sys -from pathlib import Path import xml.etree.ElementTree as ET - +from pathlib import Path ROOT = Path(__file__).resolve().parents[1] EXPECTED_LANGUAGES = ("de-DE", "en-US", "es-ES", "zh-CN", "ja-JP", "ru-RU")