forked from pool/python-iniparse
Compare commits
6 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| eb251aa0d4 | |||
| d224c6890f | |||
| 5f23a4d54f | |||
| 93349cb5be | |||
| d7f5985499 | |||
| 21110c5801 |
49
py314.patch
Normal file
49
py314.patch
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
From 42d34719f01229b25d2725cb56e7a527a3ec35cc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karolina Surma <ksurma@redhat.com>
|
||||||
|
Date: Wed, 12 Mar 2025 14:46:09 +0100
|
||||||
|
Subject: [PATCH] Avoid the multiprocessing forkserver method
|
||||||
|
|
||||||
|
From Python 3.14 on, the default method of spawning processes on
|
||||||
|
non-macOS POSIX systems has been changed from fork to forkserver.
|
||||||
|
Ensure the correct method is used in the test.
|
||||||
|
---
|
||||||
|
tests/test_multiprocessing.py | 14 ++++++++++++--
|
||||||
|
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_multiprocessing.py b/tests/test_multiprocessing.py
|
||||||
|
index 44a891b..01a5a0c 100644
|
||||||
|
--- a/tests/test_multiprocessing.py
|
||||||
|
+++ b/tests/test_multiprocessing.py
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
import unittest
|
||||||
|
try:
|
||||||
|
- from multiprocessing import Process, Queue, Pipe
|
||||||
|
+ from multiprocessing import Process, Queue, Pipe, get_start_method, get_context
|
||||||
|
disabled = False
|
||||||
|
except ImportError:
|
||||||
|
Process = None
|
||||||
|
@@ -14,6 +14,16 @@
|
||||||
|
class TestIni(unittest.TestCase):
|
||||||
|
"""Test sending INIConfig objects."""
|
||||||
|
|
||||||
|
+ # Since Python 3.14 on non-macOS POSIX systems
|
||||||
|
+ # the default method has been changed to forkserver.
|
||||||
|
+ # The code in this module does not work with it,
|
||||||
|
+ # hence the explicit change to 'fork'
|
||||||
|
+ # See https://github.com/python/cpython/issues/125714
|
||||||
|
+ if get_start_method() == "forkserver":
|
||||||
|
+ _mp_context = get_context(method="fork")
|
||||||
|
+ else:
|
||||||
|
+ _mp_context = get_context()
|
||||||
|
+
|
||||||
|
def test_queue(self):
|
||||||
|
def getxy(_q, _w):
|
||||||
|
_cfg = _q.get_nowait()
|
||||||
|
@@ -23,6 +33,6 @@ def getxy(_q, _w):
|
||||||
|
q = Queue()
|
||||||
|
w = Queue()
|
||||||
|
q.put(cfg)
|
||||||
|
- p = Process(target=getxy, args=(q, w))
|
||||||
|
+ p = self._mp_context.Process(target=getxy, args=(q, w))
|
||||||
|
p.start()
|
||||||
|
self.assertEqual(w.get(timeout=1), '42')
|
||||||
@@ -1,3 +1,19 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 8 03:58:35 UTC 2025 - Markéta Machová <mmachova@suse.com>
|
||||||
|
|
||||||
|
- Add py314.patch to fix tests with Python 3.14
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Aug 28 06:23:41 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Add patch use-load-tests.patch:
|
||||||
|
* Use the load tests protocol to run the testsuite.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jun 21 03:22:35 UTC 2024 - Manuel Jacob <me@manueljacob.de>
|
||||||
|
|
||||||
|
- add %{?sle15_python_module_pythons}
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Feb 29 23:36:16 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
Thu Feb 29 23:36:16 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-iniparse
|
# spec file for package python-iniparse
|
||||||
#
|
#
|
||||||
# Copyright (c) 2024 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC and contributors
|
||||||
# Copyright (c) 2017 Neal Gompa <ngompa13@gmail.com>.
|
# Copyright (c) 2017 Neal Gompa <ngompa13@gmail.com>.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-iniparse
|
Name: python-iniparse
|
||||||
Version: 0.5
|
Version: 0.5
|
||||||
Release: 0
|
Release: 0
|
||||||
@@ -34,6 +35,10 @@ Patch2: python-iniparse-no-six.patch
|
|||||||
Patch3: python311-compat.patch
|
Patch3: python311-compat.patch
|
||||||
# PATCH-FIX-UPSTREAM: python3117.patch gh#candlepin/python-iniparse#29
|
# PATCH-FIX-UPSTREAM: python3117.patch gh#candlepin/python-iniparse#29
|
||||||
Patch4: python3117.patch
|
Patch4: python3117.patch
|
||||||
|
# PATCH-FIX-UPSTREAM Based on gh#candlepin/python-iniparse#32
|
||||||
|
Patch5: use-load-tests.patch
|
||||||
|
# PATCH-FIX-UPSTREAM https://github.com/candlepin/python-iniparse/commit/42d34719f01229b25d2725cb56e7a527a3ec35cc Avoid the multiprocessing forkserver method
|
||||||
|
Patch6: py314.patch
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: %{python_module testsuite}
|
BuildRequires: %{python_module testsuite}
|
||||||
@@ -53,7 +58,6 @@ are preserved when data is updated), and is more convenient to use.
|
|||||||
%autosetup -p1 -n iniparse-%{version}
|
%autosetup -p1 -n iniparse-%{version}
|
||||||
|
|
||||||
chmod 644 html/index.html
|
chmod 644 html/index.html
|
||||||
sed -i "/.*test_multiprocessing.*/d" tests/__init__.py # NOTE(saschpe): Doesn't work and I'm lazy
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%pyproject_wheel
|
%pyproject_wheel
|
||||||
|
|||||||
252
use-load-tests.patch
Normal file
252
use-load-tests.patch
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
From dee4a4df2dbaa050568e0a58b1077eb8340d7244 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Steve Kowalik <steven@wedontsleep.org>
|
||||||
|
Date: Mon, 26 Aug 2024 17:05:07 +1000
|
||||||
|
Subject: [PATCH] Use load tests protocol to run the test suite
|
||||||
|
|
||||||
|
Since we no longer require Python 2, we can make use of the load tests
|
||||||
|
protocol and automatic discovery to find all tests we want to run,
|
||||||
|
rather than constructing a list of TestSuites by hand. As a consequence,
|
||||||
|
I've had to fiddle with two test classes so they are not discovered and
|
||||||
|
run. Drive-by the tox environment list as well.
|
||||||
|
---
|
||||||
|
runtests.py | 18 +++++++++++++++---
|
||||||
|
tests/__init__.py | 26 --------------------------
|
||||||
|
tests/test_compat.py | 30 ++++--------------------------
|
||||||
|
tests/test_fuzz.py | 7 -------
|
||||||
|
tests/test_ini.py | 11 -----------
|
||||||
|
tests/test_misc.py | 14 --------------
|
||||||
|
tests/test_multiprocessing.py | 10 ----------
|
||||||
|
tests/test_tidy.py | 7 -------
|
||||||
|
tests/test_unicode.py | 7 -------
|
||||||
|
tox.ini | 2 +-
|
||||||
|
10 files changed, 20 insertions(+), 112 deletions(-)
|
||||||
|
|
||||||
|
Index: iniparse-0.5/runtests.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/runtests.py
|
||||||
|
+++ iniparse-0.5/runtests.py
|
||||||
|
@@ -1,8 +1,20 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
-import tests
|
||||||
|
+import doctest
|
||||||
|
+import os
|
||||||
|
+import unittest
|
||||||
|
+
|
||||||
|
+from iniparse import config
|
||||||
|
+from iniparse import ini
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def load_tests(loader, tests, pattern):
|
||||||
|
+ tests_dir = os.path.join(os.path.dirname(__file__), "tests")
|
||||||
|
+ package_tests = loader.discover(start_dir=tests_dir)
|
||||||
|
+ tests.addTests(package_tests)
|
||||||
|
+ tests.addTests((doctest.DocTestSuite(config), doctest.DocTestSuite(ini)))
|
||||||
|
+ return tests
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
- import unittest
|
||||||
|
- unittest.main(defaultTest='tests.Suite')
|
||||||
|
+ unittest.main()
|
||||||
|
Index: iniparse-0.5/tests/__init__.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/__init__.py
|
||||||
|
+++ iniparse-0.5/tests/__init__.py
|
||||||
|
@@ -1,26 +0,0 @@
|
||||||
|
-import unittest, doctest
|
||||||
|
-
|
||||||
|
-from . import test_ini
|
||||||
|
-from . import test_misc
|
||||||
|
-from . import test_fuzz
|
||||||
|
-from . import test_compat
|
||||||
|
-from . import test_unicode
|
||||||
|
-from . import test_tidy
|
||||||
|
-from . import test_multiprocessing
|
||||||
|
-from iniparse import config
|
||||||
|
-from iniparse import ini
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- doctest.DocTestSuite(config),
|
||||||
|
- doctest.DocTestSuite(ini),
|
||||||
|
- test_ini.Suite(),
|
||||||
|
- test_misc.Suite(),
|
||||||
|
- test_fuzz.Suite(),
|
||||||
|
- test_compat.Suite(),
|
||||||
|
- test_unicode.Suite(),
|
||||||
|
- test_tidy.Suite(),
|
||||||
|
- test_multiprocessing.Suite(),
|
||||||
|
- ])
|
||||||
|
Index: iniparse-0.5/tests/test_compat.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/test_compat.py
|
||||||
|
+++ iniparse-0.5/tests/test_compat.py
|
||||||
|
@@ -37,7 +37,7 @@ class SortedDict(UserDict.UserDict):
|
||||||
|
return iter(self.values())
|
||||||
|
|
||||||
|
|
||||||
|
-class TestCaseBase(unittest.TestCase):
|
||||||
|
+class BaseTestCase:
|
||||||
|
def newconfig(self, defaults=None):
|
||||||
|
if defaults is None:
|
||||||
|
self.cf = self.config_class()
|
||||||
|
@@ -327,7 +327,7 @@ class TestCaseBase(unittest.TestCase):
|
||||||
|
self.assertEqual(L, expected)
|
||||||
|
|
||||||
|
|
||||||
|
-class ConfigParserTestCase(TestCaseBase):
|
||||||
|
+class ConfigParserTestCase(BaseTestCase, unittest.TestCase):
|
||||||
|
config_class = ConfigParser.ConfigParser
|
||||||
|
|
||||||
|
def test_interpolation(self):
|
||||||
|
@@ -378,7 +378,7 @@ class ConfigParserTestCase(TestCaseBase)
|
||||||
|
'string_with_interpolation', raw=False)
|
||||||
|
|
||||||
|
|
||||||
|
-class RawConfigParserTestCase(TestCaseBase):
|
||||||
|
+class RawConfigParserTestCase(BaseTestCase, unittest.TestCase):
|
||||||
|
config_class = ConfigParser.RawConfigParser
|
||||||
|
|
||||||
|
def test_interpolation(self):
|
||||||
|
@@ -459,6 +459,7 @@ class SafeConfigParserTestCase(ConfigPar
|
||||||
|
self.assertRaises(ValueError, cf.add_section, "DEFAULT")
|
||||||
|
|
||||||
|
|
||||||
|
+@unittest.skip("Skipped for now")
|
||||||
|
class SortedTestCase(RawConfigParserTestCase):
|
||||||
|
def newconfig(self, defaults=None):
|
||||||
|
self.cf = self.config_class(defaults=defaults, dict_type=SortedDict)
|
||||||
|
@@ -482,26 +483,3 @@ class SortedTestCase(RawConfigParserTest
|
||||||
|
"o2 = 3\n"
|
||||||
|
"o3 = 2\n"
|
||||||
|
"o4 = 1\n\n")
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-def test_main():
|
||||||
|
- test_support.run_unittest(
|
||||||
|
- ConfigParserTestCase,
|
||||||
|
- RawConfigParserTestCase,
|
||||||
|
- SafeConfigParserTestCase,
|
||||||
|
- SortedTestCase
|
||||||
|
- )
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- unittest.makeSuite(RawConfigParserTestCase, 'test'),
|
||||||
|
- unittest.makeSuite(ConfigParserTestCase, 'test'),
|
||||||
|
- unittest.makeSuite(SafeConfigParserTestCase, 'test'),
|
||||||
|
- # unittest.makeSuite(SortedTestCase, 'test')
|
||||||
|
- ])
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-if __name__ == "__main__":
|
||||||
|
- test_main()
|
||||||
|
Index: iniparse-0.5/tests/test_fuzz.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/test_fuzz.py
|
||||||
|
+++ iniparse-0.5/tests/test_fuzz.py
|
||||||
|
@@ -130,10 +130,3 @@ class TestFuzz(unittest.TestCase):
|
||||||
|
|
||||||
|
def assertEqualSorted(self, l1, l2):
|
||||||
|
self.assertEqual(sorted(l1), sorted(l2))
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- unittest.makeSuite(TestFuzz, 'test'),
|
||||||
|
- ])
|
||||||
|
Index: iniparse-0.5/tests/test_ini.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/test_ini.py
|
||||||
|
+++ iniparse-0.5/tests/test_ini.py
|
||||||
|
@@ -437,14 +437,3 @@ bumble=bee
|
||||||
|
ip.section.option2 = 'bazz'
|
||||||
|
ip.section.option3 = 'spam'
|
||||||
|
self.assertEqual(str(ip), self.s8)
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- unittest.makeSuite(TestSectionLine, 'test'),
|
||||||
|
- unittest.makeSuite(TestOptionLine, 'test'),
|
||||||
|
- unittest.makeSuite(TestCommentLine, 'test'),
|
||||||
|
- unittest.makeSuite(TestOtherLines, 'test'),
|
||||||
|
- unittest.makeSuite(TestIni, 'test'),
|
||||||
|
- ])
|
||||||
|
Index: iniparse-0.5/tests/test_misc.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/test_misc.py
|
||||||
|
+++ iniparse-0.5/tests/test_misc.py
|
||||||
|
@@ -452,17 +452,3 @@ class TestCommentSyntax(unittest.TestCas
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
ini.change_comment_syntax(';#', True)
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- unittest.makeSuite(TestOptionxFormOverride, 'test'),
|
||||||
|
- unittest.makeSuite(TestReadline, 'test'),
|
||||||
|
- unittest.makeSuite(TestMultilineWithComments, 'test'),
|
||||||
|
- unittest.makeSuite(TestEmptyFile, 'test'),
|
||||||
|
- unittest.makeSuite(TestCustomDict, 'test'),
|
||||||
|
- unittest.makeSuite(TestCompat, 'test'),
|
||||||
|
- unittest.makeSuite(TestPickle, 'test'),
|
||||||
|
- unittest.makeSuite(TestCommentSyntax, 'test'),
|
||||||
|
- ])
|
||||||
|
Index: iniparse-0.5/tests/test_multiprocessing.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/test_multiprocessing.py
|
||||||
|
+++ iniparse-0.5/tests/test_multiprocessing.py
|
||||||
|
@@ -26,13 +26,3 @@ class TestIni(unittest.TestCase):
|
||||||
|
p = Process(target=getxy, args=(q, w))
|
||||||
|
p.start()
|
||||||
|
self.assertEqual(w.get(timeout=1), '42')
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- if disabled:
|
||||||
|
- unittest.TestSuite.__init__(self, [])
|
||||||
|
- else:
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- unittest.makeSuite(TestIni, 'test'),
|
||||||
|
- ])
|
||||||
|
Index: iniparse-0.5/tests/test_tidy.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/test_tidy.py
|
||||||
|
+++ iniparse-0.5/tests/test_tidy.py
|
||||||
|
@@ -127,10 +127,3 @@ class TestTidy(unittest.TestCase):
|
||||||
|
|
||||||
|
c=3
|
||||||
|
"""))
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- unittest.makeSuite(TestTidy, 'test'),
|
||||||
|
- ])
|
||||||
|
Index: iniparse-0.5/tests/test_unicode.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse-0.5.orig/tests/test_unicode.py
|
||||||
|
+++ iniparse-0.5/tests/test_unicode.py
|
||||||
|
@@ -41,10 +41,3 @@ baz = Marc-Andr\202
|
||||||
|
i = self.basic_tests(self.s2, strable=False)
|
||||||
|
self.assertEqual(i.foo.bar, 'mammal')
|
||||||
|
self.assertEqual(i.foo.baz, u'Marc-Andr\202')
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-class Suite(unittest.TestSuite):
|
||||||
|
- def __init__(self):
|
||||||
|
- unittest.TestSuite.__init__(self, [
|
||||||
|
- unittest.makeSuite(TestUnicode, 'test'),
|
||||||
|
- ])
|
||||||
Reference in New Issue
Block a user