From 58bc1fca8eca62be8696036b04e64444988a355a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 24 Oct 2023 13:32:26 +0200 Subject: [PATCH] Run lxml tests during build, avoid deprecated unittest.makeSuite() --- drop-makeSuite.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ python-defusedxml.spec | 11 ++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 drop-makeSuite.patch diff --git a/drop-makeSuite.patch b/drop-makeSuite.patch new file mode 100644 index 0000000..a8793ce --- /dev/null +++ b/drop-makeSuite.patch @@ -0,0 +1,42 @@ +From 4e6cea5f5bb44bf06dd30a723cf13334693c3150 Mon Sep 17 00:00:00 2001 +From: Christian Heimes +Date: Fri, 22 Sep 2023 14:01:50 +0200 +Subject: [PATCH] Improve tests (partial) + +- `makeSuite` is deprecated + +diff --git a/tests.py b/tests.py +index ab52aab..c60335e 100644 +--- a/tests.py ++++ b/tests.py +@@ -542,17 +559,19 @@ def test_defused_gzip_response(self): + + def test_main(): + suite = unittest.TestSuite() +- suite.addTests(unittest.makeSuite(TestDefusedcElementTree)) +- suite.addTests(unittest.makeSuite(TestDefusedElementTree)) +- suite.addTests(unittest.makeSuite(TestDefusedMinidom)) +- suite.addTests(unittest.makeSuite(TestDefusedMinidomWithParser)) +- suite.addTests(unittest.makeSuite(TestDefusedPulldom)) +- suite.addTests(unittest.makeSuite(TestDefusedSax)) +- suite.addTests(unittest.makeSuite(TestXmlRpc)) +- if lxml is not None: +- suite.addTests(unittest.makeSuite(TestDefusedLxml)) +- if gzip is not None: +- suite.addTests(unittest.makeSuite(TestDefusedGzip)) ++ cls = [ ++ TestDefusedElementTree, ++ TestDefusedcElementTree, ++ TestDefusedMinidom, ++ TestDefusedMinidomWithParser, ++ TestDefusedPulldom, ++ TestDefusedSax, ++ TestDefusedLxml, ++ TestXmlRpc, ++ TestDefusedGzip, ++ ] ++ for c in cls: ++ suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(c)) + return suite + + diff --git a/python-defusedxml.spec b/python-defusedxml.spec index 8272c8f..62a8703 100644 --- a/python-defusedxml.spec +++ b/python-defusedxml.spec @@ -4,16 +4,22 @@ %global upstream_version %{base_version}%{?prerel} Name: python-%{pypi_name} Version: %{base_version}%{?prerel:~%{prerel}} -Release: 9%{?dist} +Release: 10%{?dist} Summary: XML bomb protection for Python stdlib modules License: Python URL: https://github.com/tiran/defusedxml Source0: %{pypi_source %{pypi_name} %{upstream_version}} +# Drop deprecated unittest.makeSuite() +# From https://github.com/tiran/defusedxml/commit/4e6cea5f5b +# (This no longer skips lxml tests when lxml is not installed.) +Patch: drop-makeSuite.patch + BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-lxml %description The defusedxml package contains several Python-only workarounds and fixes for @@ -56,6 +62,9 @@ module. This is the python%{python3_pkgversion} build. %changelog +* Tue Oct 24 2023 Miro HronĨok - 0.7.1-10 +- Run lxml tests during build, avoid deprecated unittest.makeSuite() + * Fri Jul 21 2023 Fedora Release Engineering - 0.7.1-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild