From e6b3001848810ad892921ff0dbfcdb375896400fc991a0f341d043ff1bf4751a Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 2 May 2025 21:30:36 +0000 Subject: [PATCH] - Add 767-skip-xc20p-tests.patch to skip unavailable tests (gh#authlib/authlib#456). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Authlib?expand=0&rev=47 --- 767-skip-xc20p-tests.patch | 39 ++++++++++++++++++++++++++++++++++++++ python-Authlib.changes | 6 ++++++ python-Authlib.spec | 4 ++++ 3 files changed, 49 insertions(+) create mode 100644 767-skip-xc20p-tests.patch diff --git a/767-skip-xc20p-tests.patch b/767-skip-xc20p-tests.patch new file mode 100644 index 0000000..f264300 --- /dev/null +++ b/767-skip-xc20p-tests.patch @@ -0,0 +1,39 @@ +From 8f823db3fe552b8337cce1eb4ec4207411c63d0b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=89loi=20Rivard?= +Date: Thu, 1 May 2025 10:04:21 +0200 +Subject: [PATCH] fix: skip xc20p unit tests when unavailable in cryptodome + +--- + tests/jose/test_chacha20.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: authlib-1.5.2/tests/jose/test_chacha20.py +=================================================================== +--- authlib-1.5.2.orig/tests/jose/test_chacha20.py 2025-04-02 12:30:25.000000000 +0200 ++++ authlib-1.5.2/tests/jose/test_chacha20.py 2025-05-02 18:21:41.958090585 +0200 +@@ -1,5 +1,7 @@ + import unittest + ++import pytest ++ + from authlib.jose import JsonWebEncryption + from authlib.jose import OctKey + from authlib.jose.drafts import register_jwe_draft +@@ -22,6 +24,8 @@ + self.assertRaises(ValueError, jwe.serialize_compact, protected, b"hello", key2) + + def test_dir_alg_xc20p(self): ++ pytest.importorskip("Cryptodome.Cipher.ChaCha20_Poly1305") ++ + jwe = JsonWebEncryption() + key = OctKey.generate_key(256, is_private=True) + protected = {"alg": "dir", "enc": "XC20P"} +@@ -35,6 +39,8 @@ + self.assertRaises(ValueError, jwe.serialize_compact, protected, b"hello", key2) + + def test_xc20p_content_encryption_decryption(self): ++ pytest.importorskip("Cryptodome.Cipher.ChaCha20_Poly1305") ++ + # https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha-03#appendix-A.3.1 + enc = JsonWebEncryption.ENC_REGISTRY["XC20P"] + diff --git a/python-Authlib.changes b/python-Authlib.changes index 9b28224..11231a1 100644 --- a/python-Authlib.changes +++ b/python-Authlib.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri May 2 21:29:54 UTC 2025 - Matej Cepl + +- Add 767-skip-xc20p-tests.patch to skip unavailable tests + (gh#authlib/authlib#456). + ------------------------------------------------------------------- Wed Apr 23 10:49:33 UTC 2025 - John Paul Adrian Glaubitz diff --git a/python-Authlib.spec b/python-Authlib.spec index fcd80f1..3d58a88 100644 --- a/python-Authlib.spec +++ b/python-Authlib.spec @@ -25,6 +25,9 @@ Summary: Python library for building OAuth and OpenID Connect servers License: BSD-3-Clause URL: https://authlib.org/ Source: https://github.com/lepture/%{modname}/archive/refs/tags/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 767-skip-xc20p-tests.patch bsc#[0-9]+ mcepl@suse.com +# skip unavailable tests +Patch0: 767-skip-xc20p-tests.patch BuildRequires: %{python_module base >= 3.9} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} @@ -74,6 +77,7 @@ $python -mpytest tests/core $python -mpytest tests/flask # gh#lepture/authlib#456 $python -mpytest tests/jose -k 'not (test_dir_alg_xc20p or test_xc20p_content_encryption_decryption)' +# $python -mpytest tests/jose export DJANGO_SETTINGS_MODULE=tests.clients.test_django.settings $python -mpytest tests/clients # export DJANGO_SETTINGS_MODULE=tests.django.settings