okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

nekomimi.petfix: preserve Python 3.11 compatibility in remote kernels77f1bc8

main
891 B26 linesraw
1"""Keep the shipped kernel parseable on the version in pyrightconfig.json.
2
3E2E uses the local interpreter, so Python 3.14 can hide syntax that breaks
4remote boot on older hosts. Check every module, including disabled plugins.
5"""
6
7import ast
8import json
9import unittest
10from pathlib import Path
11
12ROOT = Path(__file__).resolve().parents[2]
13
14
15class PythonCompatibilityTest(unittest.TestCase):
16    def test_bundle_parses_on_supported_python(self):
17        config = json.loads((ROOT / "pyrightconfig.json").read_text())
18        major, minor = config["pythonVersion"].split(".")
19        version = (int(major), int(minor))
20        for path in sorted((ROOT / "priv" / "python").rglob("*.py")):
21            with self.subTest(path=str(path.relative_to(ROOT))):
22                ast.parse(path.read_text(), filename=str(path), feature_version=version)
23
24
25if __name__ == "__main__":
26    unittest.main()