From 20299a480d2934ef4a355596c7c1c229db614ab2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 16:12:40 +0000 Subject: [PATCH 1/3] Update dependency pytest to v9.1.0 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- poetry.lock | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index 663093da..20875694 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1021,8 +1021,8 @@ files = [ google-auth = ">=2.14.1,<3.0.0" googleapis-common-protos = ">=1.63.2,<2.0.0" proto-plus = [ - {version = ">=1.24.0,<2.0.0"}, {version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""}, + {version = ">=1.24.0,<2.0.0", markers = "python_version < \"3.13\""}, ] protobuf = ">=5.29.6,<8.0.0" requests = ">=2.33.0,<3.0.0" @@ -2149,8 +2149,8 @@ files = [ astroid = ">=4.0.2,<=4.1.dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ - {version = ">=0.2", markers = "python_version < \"3.11\""}, {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, + {version = ">=0.2", markers = "python_version < \"3.11\""}, {version = ">=0.3.6", markers = "python_version == \"3.11\""}, ] isort = ">=5,<5.13 || >5.13,<9" @@ -2235,14 +2235,14 @@ files = [ [[package]] name = "pytest" -version = "9.0.3" +version = "9.1.0" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.10" groups = ["dev"] files = [ - {file = "pytest-9.0.3-py3-none-any.whl", hash = "sha256:2c5efc453d45394fdd706ade797c0a81091eccd1d6e4bccfcd476e2b8e0ab5d9"}, - {file = "pytest-9.0.3.tar.gz", hash = "sha256:b86ada508af81d19edeb213c681b1d48246c1a91d304c6c81a427674c17eb91c"}, + {file = "pytest-9.1.0-py3-none-any.whl", hash = "sha256:8ebb0e7888bdf2bdfc602ec51f8f62d50200af37356c74e503c79a94f5c81f32"}, + {file = "pytest-9.1.0.tar.gz", hash = "sha256:41dd9148c08072446394cefd3d79701701335a9f4cae69ba92e39f6c7f5c061c"}, ] [package.dependencies] @@ -3525,4 +3525,4 @@ dev = ["doc8", "flake8", "flake8-import-order", "rstcheck[sphinx]", "ruff", "sph [metadata] lock-version = "2.1" python-versions = ">=3.10, <3.15" -content-hash = "977346b43825a9cfe162662f246b05d2d0ed97e58cd31e95591a3346337f6925" +content-hash = "5f1d1c25554858d6e2e7f8699722a48ef87325069e3d769dc7daab0075395b6e" diff --git a/pyproject.toml b/pyproject.toml index dd305388..dca05420 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,7 @@ pygobuildinfo = "0.1.28" [tool.poetry.group.dev.dependencies] tox = "3.28.0" -pytest = "9.0.3" +pytest = "9.1.0" pytest-xdist = "3.8.0" pytest-benchmark = "5.2.3" responses = "0.26.1" From 828a534472bfb01714f55388eb997c5c9f788ec9 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Wed, 17 Jun 2026 08:55:38 +0200 Subject: [PATCH 2/3] Materialize zipped lists in tests Passing iterators in `@pytest.mark.parametrize` has been deprecated in pytest 9.1.0. --- tests/test_k8sobject.py | 118 +++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/tests/test_k8sobject.py b/tests/test_k8sobject.py index e52f5e85..161dcdec 100644 --- a/tests/test_k8sobject.py +++ b/tests/test_k8sobject.py @@ -72,61 +72,63 @@ @pytest.mark.parametrize( "k8sdict,expected", - zip( - [None] + _test_objs, - [ - { - "kind": "", - "name": "", - "namespace": "", - }, - { - "kind": "ServiceAccount", - "name": "test", - "namespace": "test", - }, - { - "kind": "ServiceAccount", - "name": "test-sa-2", - "namespace": "test", - }, - { - "kind": "Pod", - "name": "test", - "namespace": "test", - }, - { - "kind": "Role", - "name": "test-role", - "namespace": "test", - "spec": { - "test": "testing", + list( + zip( + [None] + _test_objs, + [ + { + "kind": "", + "name": "", + "namespace": "", }, - }, - { - "kind": "Role", - "name": "test-role", - "namespace": "test-2", - "spec": { - "test": "testing2", + { + "kind": "ServiceAccount", + "name": "test", + "namespace": "test", }, - }, - { - "kind": "ClusterRole", - "namespace": "", - "name": "test-cr", - }, - { - "kind": "ClusterRole", - "namespace": "", - "name": "test-cr-2", - }, - { - "name": "", - "namespace": "", - "kind": "", - }, - ], + { + "kind": "ServiceAccount", + "name": "test-sa-2", + "namespace": "test", + }, + { + "kind": "Pod", + "name": "test", + "namespace": "test", + }, + { + "kind": "Role", + "name": "test-role", + "namespace": "test", + "spec": { + "test": "testing", + }, + }, + { + "kind": "Role", + "name": "test-role", + "namespace": "test-2", + "spec": { + "test": "testing2", + }, + }, + { + "kind": "ClusterRole", + "namespace": "", + "name": "test-cr", + }, + { + "kind": "ClusterRole", + "namespace": "", + "name": "test-cr-2", + }, + { + "name": "", + "namespace": "", + "kind": "", + }, + ], + ) ), ) def test_k8sobject_constructor(k8sdict, expected): @@ -164,10 +166,12 @@ def test_k8sobject_constructor(k8sdict, expected): @pytest.mark.parametrize( "k8sdict,to_cluster_scoped,to_ns_scoped", - zip( - _test_objs, - [False, False, False, False, False, True, True, True], - [False, False, True, True, True, True, True, True], + list( + zip( + _test_objs, + [False, False, False, False, False, True, True, True], + [False, False, True, True, True, True, True, True], + ) ), ) def test_k8sobject_less_than(k8sdict, to_cluster_scoped, to_ns_scoped): From 48e2f683f2c4c8051f26cb225f4f13878f99624f Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Wed, 17 Jun 2026 08:56:35 +0200 Subject: [PATCH 3/3] Fix jwt.encode() warning by using 32 character secrets in tests --- tests/test_config.py | 4 ++-- tests/test_login.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 21e39465..3f1b109f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -339,7 +339,7 @@ def mock_get_token(url: str) -> Optional[str]: return { "id_token": jwt.encode( {"exp": time.time() + 100, "from_cache": True}, - "secret", + "secret10" * 4, algorithm="HS256", ) } @@ -347,7 +347,7 @@ def mock_get_token(url: str) -> Optional[str]: return { "id_token": jwt.encode( {"exp": time.time() - 100, "from_cache": True}, - "secret", + "secret10" * 4, algorithm="HS256", ) } diff --git a/tests/test_login.py b/tests/test_login.py index f2c6d1ca..a8575c41 100644 --- a/tests/test_login.py +++ b/tests/test_login.py @@ -27,6 +27,8 @@ from commodore import login from commodore import tokencache +akey = "a" * 32 + def mock_open_browser(authorization_endpoint: str, code="foobar"): def mock(request_uri: str): @@ -156,7 +158,7 @@ def test_fetch_token(mock_login, config: Config, tmp_path, fs, cached): if cached: expected_token_payload["marker"] = "id-456" - expected_token = jwt.encode(expected_token_payload, "aaaaaa") + expected_token = jwt.encode(expected_token_payload, akey) if cached: cache_contents = {config.api_url: {"id_token": expected_token}} @@ -199,13 +201,13 @@ def test_refresh_tokens(config: Config, tmp_path, fs, idp_status_code): } current_tokens = { - "id_token": jwt.encode(current_id_token, "aaaaaa"), - "refresh_token": jwt.encode(current_refresh_token, "aaaaaa"), + "id_token": jwt.encode(current_id_token, akey), + "refresh_token": jwt.encode(current_refresh_token, akey), } new_tokens = { "access_token": "dummy-access-token-456", - "id_token": jwt.encode(new_id_token, "aaaaaa"), - "refresh_token": jwt.encode(new_refresh_token, "aaaaaa"), + "id_token": jwt.encode(new_id_token, akey), + "refresh_token": jwt.encode(new_refresh_token, akey), } cache_contents = {config.api_url: current_tokens} @@ -263,14 +265,14 @@ def test_refresh_tokens_not_needed( id_token = {"marker": "id", "exp": time.time() - 10} tokens = { - "id_token": jwt.encode(id_token, "aaaaaa"), + "id_token": jwt.encode(id_token, akey), } if expired_refresh_token: tokens["refresh_token"] = jwt.encode( - {"marker": "R", "exp": time.time() - 10}, "aaaaaa" + {"marker": "R", "exp": time.time() - 10}, akey ) if broken_refresh_token: - rt = jwt.encode({"marker": "R", "exp": time.time() + 600}, "aaaaaa") + rt = jwt.encode({"marker": "R", "exp": time.time() + 600}, akey) tokens["refresh_token"] = f"X{rt[1:]}" cache_contents = {config.api_url: tokens} fs.create_file(