Skip to content

Commit 5698b3f

Browse files
ci: test Ops 2.23 with Python 3.14 (#2576)
#2546 is blocked because we don't run the tests on this branch with Python 3.14, but these are configured as required checks. Since Ops 2.23 only specifies Python `>=3.8`, we'd expect it to run fine with Python 3.14. In addition to adding 3.14 to the list of versions in CI, we also need to add it to the list of environments in `tox.ini`, and follow #2091 in patching some of the tests: we now need to wrap our `functools.partial` objects in `staticmethod` due to `partial` implementing the decriptor protocol in Python 3.14 (python/cpython#121027, python/cpython#121089). However, because we're on an older `pyright` version in this maintenance branch, this leads to type checking errors which we ignore (bumping `pyright` resolves this but introduces 20+ other errors which would add noise to this PR).
1 parent e0d829b commit 5698b3f

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎.github/workflows/framework-tests.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
fail-fast: false
4848
matrix:
4949
os: [ubuntu-latest, macos-latest]
50-
python-version: ["3.8", "3.10", "3.12"]
50+
python-version: ["3.8", "3.10", "3.12", "3.14"]
5151
exclude:
5252
- {python-version: "3.8", os: "macos-latest"} # macos-14 is arm64, and there's no Python 3.8 build for arm64
5353

‎test/test_model_relation_data_class.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ def json_nested_hook(dct: dict[str, Any]) -> Nested | dict[str, Any]:
129129

130130

131131
class MyCharm(BaseTestCharm):
132-
encoder = nested_encode
133-
decoder = nested_decode
132+
encoder = staticmethod(nested_encode) # type: ignore[reportAssignmentType]
133+
decoder = staticmethod(nested_decode) # type: ignore[reportAssignmentType]
134134

135135
@property
136136
def databag_class(self) -> type[DatabagProtocol]:
@@ -782,8 +782,8 @@ def __setattr__(self, key: str, value: Any):
782782

783783

784784
class CommonTypesDataclasses(BaseTestCharmCommonTypes):
785-
encoder = json_ip_and_country_encode
786-
decoder = json_ip_decode
785+
encoder = staticmethod(json_ip_and_country_encode) # type: ignore[reportAssignmentType]
786+
decoder = staticmethod(json_ip_decode) # type: ignore[reportAssignmentType]
787787

788788
@property
789789
def databag_class(self):
@@ -802,7 +802,7 @@ class _DataPydanticDataclass:
802802
origin: Country
803803

804804
class CommonTypesPydanticDataclass(BaseTestCharmCommonTypes):
805-
encoder = json_ip_and_country_encode
805+
encoder = staticmethod(json_ip_and_country_encode) # type: ignore[reportAssignmentType]
806806

807807
@property
808808
def databag_class(self):

‎tox.ini‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ allowlist_externals = cp
7878
dependency_groups = unit, static
7979
commands = pyright {posargs}
8080

81-
[testenv:py{3.8,3.10,3.12}-unit]
81+
[testenv:py{3.8,3.10,3.12,3.14}-unit]
8282
runner = uv-venv-lock-runner
8383
base=unit
8484

‎tracing/tox.ini‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ deps =
77
-e ../testing
88
-e .
99

10-
[testenv:py{3.8,3.10,3.12}-unit]
10+
[testenv:py{3.8,3.10,3.12,3.14}-unit]
1111
base=unit
1212

1313
[testenv:unit]

0 commit comments

Comments
 (0)