fix: keep the screen tests importable on 3.8

tests/sources.py used functools.cache (3.9) and test_install_selection
imported resolve.regions, which reaches core.cli and its 3.9 floor exit.
Both broke python3.8 -m unittest tests.test_install_tui in Validation.

ruff UP033 asks for functools.cache under target py39, so the modules the
3.8 run imports take the same UP exemption as installer/.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 00:08:06 +01:00
1 parent 5be9a9fa2d
commit 26c45da318
3 files changed
+12 -4

No files matched your search

+7
View File
@@ -107,5 +107,12 @@ max-returns = 10
[tool.ruff.lint.per-file-ignores]
"install.py" = ["UP"]
"installer/*.py" = ["UP"]
# The full-screen tests and the modules they import run under the 3.8 floor too.
"tests/__init__.py" = ["UP"]
"tests/sources.py" = ["UP"]
"tests/netguard/*.py" = ["UP"]
"tests/test_install_tui.py" = ["UP"]
"tests/test_install_app.py" = ["UP"]
"tests/test_install_selection.py" = ["UP"]
# Shell fixtures inside string literals keep the tabs the real files have.
"tests/test_launchers_*.py" = ["E101"]
+2 -2
View File
@@ -8,7 +8,7 @@ command keeps its options, the packages keep the rest.
from __future__ import annotations
import ast
from functools import cache
from functools import lru_cache
from pathlib import Path
SCRIPTS = Path(__file__).resolve().parents[1] / "scripts"
@@ -129,7 +129,7 @@ def _add_argument_flags(tree: ast.AST) -> set[str]:
}
@cache
@lru_cache(maxsize=None)
def declared_options(source: str) -> frozenset[str]:
"""The long options a script's source declares: its add_argument calls and
the shared ones core.cli's add_repo_inputs and add_emulator_selection add."""
+3 -2
View File
@@ -32,11 +32,12 @@ from unittest import mock
from pathlib import Path
from model import region
from resolve import regions as resolve_regions
# The screen tests run under 3.8 and import this module for its fakes. The
# pack builder stops below 3.9, so its modules load only above that floor.
# build scripts stop below 3.9 (core.cli), so their modules load only above
# that floor.
if sys.version_info >= (3, 9):
from resolve import regions as resolve_regions
from packs import archive, coverage, platformpack
from packs import manifest as packs_manifest