From 79b14d3e7bbeeb050a5946ddfd281e9bd3eaf4adfef821c54655f3f5bbfd95df Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 15 Aug 2023 08:29:42 +0000 Subject: [PATCH] - add 31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch dae602d37493bae239e0e8db5b3dabafebfd59db.patch: python 3.12 compat OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pexpect?expand=0&rev=76 --- ...b7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch | 270 ++++++++++++++++++ ...02d37493bae239e0e8db5b3dabafebfd59db.patch | 93 ++++++ python-pexpect.changes | 6 + python-pexpect.spec | 3 + 4 files changed, 372 insertions(+) create mode 100644 31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch create mode 100644 dae602d37493bae239e0e8db5b3dabafebfd59db.patch diff --git a/31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch b/31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch new file mode 100644 index 0000000..907274f --- /dev/null +++ b/31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch @@ -0,0 +1,270 @@ +From 31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5 Mon Sep 17 00:00:00 2001 +From: Scott Talbert +Date: Thu, 2 Feb 2023 19:59:38 -0500 +Subject: [PATCH] tests: Replace deprecated unittest.makeSuite + +This function was never formally documented, but has been deprecated and +will be removed in Python 3.13. Replaced with +unittest.TestLoader.loadTestsFromTestCase. +--- + tests/deprecated_test_filedescriptor.py | 2 +- + tests/deprecated_test_run_out_of_pty.py | 2 +- + tests/test_ansi.py | 2 +- + tests/test_command_list_split.py | 2 +- + tests/test_constructor.py | 2 +- + tests/test_ctrl_chars.py | 2 +- + tests/test_destructor.py | 2 +- + tests/test_dotall.py | 2 +- + tests/test_expect.py | 2 +- + tests/test_filedescriptor.py | 2 +- + tests/test_interact.py | 2 +- + tests/test_isalive.py | 2 +- + tests/test_log.py | 2 +- + tests/test_misc.py | 2 +- + tests/test_missing_command.py | 2 +- + tests/test_performance.py | 2 +- + tests/test_popen_spawn.py | 2 +- + tests/test_screen.py | 2 +- + tests/test_socket.py | 2 +- + tests/test_timeout_pattern.py | 2 +- + tests/test_unicode.py | 2 +- + tests/test_winsize.py | 2 +- + 22 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/tests/deprecated_test_filedescriptor.py b/tests/deprecated_test_filedescriptor.py +index 6b0ef3e8..cd930cfd 100755 +--- a/tests/deprecated_test_filedescriptor.py ++++ b/tests/deprecated_test_filedescriptor.py +@@ -72,7 +72,7 @@ def test_fd_isatty (self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(ExpectTestCase, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(ExpectTestCase) + + #fout = open('delete_me_1','wb') + #fout.write(the_old_way) +diff --git a/tests/deprecated_test_run_out_of_pty.py b/tests/deprecated_test_run_out_of_pty.py +index 30901476..b34094e1 100755 +--- a/tests/deprecated_test_run_out_of_pty.py ++++ b/tests/deprecated_test_run_out_of_pty.py +@@ -47,5 +47,5 @@ def OFF_test_run_out_of_pty (self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(ExpectTestCase,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(ExpectTestCase) + +diff --git a/tests/test_ansi.py b/tests/test_ansi.py +index 3d73fe8b..a49c6633 100755 +--- a/tests/test_ansi.py ++++ b/tests/test_ansi.py +@@ -236,5 +236,5 @@ def test_decode_error(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(ansiTestCase,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(ansiTestCase) + +diff --git a/tests/test_command_list_split.py b/tests/test_command_list_split.py +index 370f46e5..eeaf6c00 100755 +--- a/tests/test_command_list_split.py ++++ b/tests/test_command_list_split.py +@@ -37,4 +37,4 @@ def testSplitSizes(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(SplitCommandLineTestCase,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(SplitCommandLineTestCase) +diff --git a/tests/test_constructor.py b/tests/test_constructor.py +index 98c473ae..1b4d7172 100755 +--- a/tests/test_constructor.py ++++ b/tests/test_constructor.py +@@ -44,5 +44,5 @@ def test_named_parameters (self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(TestCaseConstructor,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseConstructor) + +diff --git a/tests/test_ctrl_chars.py b/tests/test_ctrl_chars.py +index 032027c2..0719fc75 100755 +--- a/tests/test_ctrl_chars.py ++++ b/tests/test_ctrl_chars.py +@@ -124,5 +124,5 @@ def test_sendcontrol(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(TestCtrlChars,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(TestCtrlChars) + +diff --git a/tests/test_destructor.py b/tests/test_destructor.py +index d27b6f62..01d89a09 100755 +--- a/tests/test_destructor.py ++++ b/tests/test_destructor.py +@@ -80,5 +80,5 @@ def test_destructor (self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(TestCaseDestructor,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseDestructor) + +diff --git a/tests/test_dotall.py b/tests/test_dotall.py +index 68aef3f5..44c58c52 100755 +--- a/tests/test_dotall.py ++++ b/tests/test_dotall.py +@@ -39,5 +39,5 @@ def test_precompiled (self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(TestCaseDotall,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseDotall) + +diff --git a/tests/test_expect.py b/tests/test_expect.py +index 5e54d65c..919c98fd 100755 +--- a/tests/test_expect.py ++++ b/tests/test_expect.py +@@ -714,4 +714,4 @@ def run(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(ExpectTestCase, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(ExpectTestCase) +diff --git a/tests/test_filedescriptor.py b/tests/test_filedescriptor.py +index d9164e1d..3f9d9546 100755 +--- a/tests/test_filedescriptor.py ++++ b/tests/test_filedescriptor.py +@@ -69,4 +69,4 @@ def test_fileobj(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(ExpectTestCase, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(ExpectTestCase) +diff --git a/tests/test_interact.py b/tests/test_interact.py +index 4afbd18e..62b26035 100755 +--- a/tests/test_interact.py ++++ b/tests/test_interact.py +@@ -97,5 +97,5 @@ def test_interact_exit_unicode(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(InteractTestCase, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(InteractTestCase) + +diff --git a/tests/test_isalive.py b/tests/test_isalive.py +index 5e3021e8..ba2b5d4d 100755 +--- a/tests/test_isalive.py ++++ b/tests/test_isalive.py +@@ -121,5 +121,5 @@ def test_expect_isalive_consistent_multiple_calls (self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(IsAliveTestCase, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(IsAliveTestCase) + +diff --git a/tests/test_log.py b/tests/test_log.py +index 4ad22569..e2defff3 100755 +--- a/tests/test_log.py ++++ b/tests/test_log.py +@@ -104,5 +104,5 @@ def test_log_send_and_received (self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(TestCaseLog,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseLog) + +diff --git a/tests/test_misc.py b/tests/test_misc.py +index 77847593..37a826ba 100755 +--- a/tests/test_misc.py ++++ b/tests/test_misc.py +@@ -370,4 +370,4 @@ def test_exception_tb(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(TestCaseMisc,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseMisc) +diff --git a/tests/test_missing_command.py b/tests/test_missing_command.py +index 92e47335..37756322 100755 +--- a/tests/test_missing_command.py ++++ b/tests/test_missing_command.py +@@ -34,5 +34,5 @@ def testMissingCommand(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(MissingCommandTestCase,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(MissingCommandTestCase) + +diff --git a/tests/test_performance.py b/tests/test_performance.py +index d7e2cd6a..05027a0e 100755 +--- a/tests/test_performance.py ++++ b/tests/test_performance.py +@@ -110,4 +110,4 @@ def test_large_stdout_stream(self): + if __name__ == "__main__": + unittest.main() + +-suite = unittest.makeSuite(PerformanceTestCase,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(PerformanceTestCase) +diff --git a/tests/test_popen_spawn.py b/tests/test_popen_spawn.py +index fca7493d..96c795cb 100644 +--- a/tests/test_popen_spawn.py ++++ b/tests/test_popen_spawn.py +@@ -136,4 +136,4 @@ def test_crlf_encoding(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(ExpectTestCase, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(ExpectTestCase) +diff --git a/tests/test_screen.py b/tests/test_screen.py +index 2429e57a..9e275bc4 100755 +--- a/tests/test_screen.py ++++ b/tests/test_screen.py +@@ -282,6 +282,6 @@ def test_no_bytes(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(screenTestCase,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(screenTestCase) + + +diff --git a/tests/test_socket.py b/tests/test_socket.py +index a8c85956..548d90a6 100644 +--- a/tests/test_socket.py ++++ b/tests/test_socket.py +@@ -277,4 +277,4 @@ def test_fileobj(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(ExpectTestCase, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(ExpectTestCase) +diff --git a/tests/test_timeout_pattern.py b/tests/test_timeout_pattern.py +index 5f610ef0..35d4816d 100755 +--- a/tests/test_timeout_pattern.py ++++ b/tests/test_timeout_pattern.py +@@ -89,4 +89,4 @@ def nestedFunction (spawnInstance): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(Exp_TimeoutTestCase,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(Exp_TimeoutTestCase) +diff --git a/tests/test_unicode.py b/tests/test_unicode.py +index 9b5b988a..61031672 100644 +--- a/tests/test_unicode.py ++++ b/tests/test_unicode.py +@@ -184,4 +184,4 @@ def test_unicode_argv(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(UnicodeTests, 'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(UnicodeTests) +diff --git a/tests/test_winsize.py b/tests/test_winsize.py +index be16773b..6fc78cef 100755 +--- a/tests/test_winsize.py ++++ b/tests/test_winsize.py +@@ -55,6 +55,6 @@ def test_setwinsize(self): + if __name__ == '__main__': + unittest.main() + +-suite = unittest.makeSuite(TestCaseWinsize,'test') ++suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseWinsize) + + diff --git a/dae602d37493bae239e0e8db5b3dabafebfd59db.patch b/dae602d37493bae239e0e8db5b3dabafebfd59db.patch new file mode 100644 index 0000000..2b2e62a --- /dev/null +++ b/dae602d37493bae239e0e8db5b3dabafebfd59db.patch @@ -0,0 +1,93 @@ +From dae602d37493bae239e0e8db5b3dabafebfd59db Mon Sep 17 00:00:00 2001 +From: Scott Talbert +Date: Wed, 1 Feb 2023 22:38:53 -0500 +Subject: [PATCH] tests: Replace assertRaisesRegexp with assertRaisesRegex + +unittest.TestCase.assertRaisesRegexp was deprecated in Python 3.2 and is +removed in Python 3.12. +--- + tests/PexpectTestCase.py | 2 +- + tests/test_expect.py | 8 ++++---- + tests/test_misc.py | 4 ++-- + tests/test_popen_spawn.py | 8 ++++---- + 4 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/tests/PexpectTestCase.py b/tests/PexpectTestCase.py +index 307437ef..5d7a1684 100644 +--- a/tests/PexpectTestCase.py ++++ b/tests/PexpectTestCase.py +@@ -97,7 +97,7 @@ def assertRaises(self, excClass): + raise AssertionError("%s was not raised" % excClass) + + @contextlib.contextmanager +- def assertRaisesRegexp(self, excClass, pattern): ++ def assertRaisesRegex(self, excClass, pattern): + import re + try: + yield +diff --git a/tests/test_expect.py b/tests/test_expect.py +index 5e54d65c..be6078c4 100755 +--- a/tests/test_expect.py ++++ b/tests/test_expect.py +@@ -643,13 +643,13 @@ def test_greed_exact(self): + + def test_bad_arg(self): + p = pexpect.spawn('cat') +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect(1) +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect([1, b'2']) +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect_exact(1) +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect_exact([1, b'2']) + + def test_timeout_none(self): +diff --git a/tests/test_misc.py b/tests/test_misc.py +index 77847593..3dc2b6ec 100755 +--- a/tests/test_misc.py ++++ b/tests/test_misc.py +@@ -214,7 +214,7 @@ def test_bad_child_pid(self): + # Force an invalid state to test isalive + child.ptyproc.terminated = 0 + try: +- with self.assertRaisesRegexp(pexpect.ExceptionPexpect, ++ with self.assertRaisesRegex(pexpect.ExceptionPexpect, + ".*" + expect_errmsg): + child.isalive() + finally: +@@ -224,7 +224,7 @@ def test_bad_child_pid(self): + def test_bad_arguments_suggest_fdpsawn(self): + " assert custom exception for spawn(int). " + expect_errmsg = "maybe you want to use fdpexpect.fdspawn" +- with self.assertRaisesRegexp(pexpect.ExceptionPexpect, ++ with self.assertRaisesRegex(pexpect.ExceptionPexpect, + ".*" + expect_errmsg): + pexpect.spawn(1) + +diff --git a/tests/test_popen_spawn.py b/tests/test_popen_spawn.py +index fca7493d..10d70326 100644 +--- a/tests/test_popen_spawn.py ++++ b/tests/test_popen_spawn.py +@@ -110,13 +110,13 @@ def test_unexpected_eof(self): + + def test_bad_arg(self): + p = PopenSpawn('cat') +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect(1) +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect([1, b'2']) +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect_exact(1) +- with self.assertRaisesRegexp(TypeError, '.*must be one of'): ++ with self.assertRaisesRegex(TypeError, '.*must be one of'): + p.expect_exact([1, b'2']) + + def test_timeout_none(self): diff --git a/python-pexpect.changes b/python-pexpect.changes index e853722..eb51fe2 100644 --- a/python-pexpect.changes +++ b/python-pexpect.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 15 08:29:26 UTC 2023 - Dirk Müller + +- add 31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch + dae602d37493bae239e0e8db5b3dabafebfd59db.patch: python 3.12 compat + ------------------------------------------------------------------- Thu Aug 10 12:27:03 UTC 2023 - Matthias Fehring diff --git a/python-pexpect.spec b/python-pexpect.spec index 2836014..e9625b4 100644 --- a/python-pexpect.spec +++ b/python-pexpect.spec @@ -29,6 +29,9 @@ Patch0: no-python-binary.patch Patch1: https://github.com/pexpect/pexpect/pull/715.patch Patch2: https://github.com/pexpect/pexpect/pull/684.patch Patch3: fix-fail-no-alias.patch +# Python 3.12 tests +Patch4: https://github.com/pexpect/pexpect/commit/dae602d37493bae239e0e8db5b3dabafebfd59db.patch +Patch5: https://github.com/pexpect/pexpect/commit/31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module ptyprocess} BuildRequires: %{python_module pytest}