Fix FTBFS with Python 3.12 (#2155493)
This commit is contained in:
parent
880cb29a8f
commit
7aa84642d6
270
31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch
Normal file
270
31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch
Normal file
@ -0,0 +1,270 @@
|
||||
From 31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5 Mon Sep 17 00:00:00 2001
|
||||
From: Scott Talbert <swt@techie.net>
|
||||
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)
|
||||
|
||||
|
22
373679020c6b1875293bf0e3a26d3116d605bff8.patch
Normal file
22
373679020c6b1875293bf0e3a26d3116d605bff8.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From 373679020c6b1875293bf0e3a26d3116d605bff8 Mon Sep 17 00:00:00 2001
|
||||
From: Scott Talbert <swt@techie.net>
|
||||
Date: Sun, 12 Feb 2023 21:34:51 -0500
|
||||
Subject: [PATCH] Fix SyntaxWarning in fakessh by using raw string
|
||||
|
||||
---
|
||||
tests/fakessh/ssh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/fakessh/ssh b/tests/fakessh/ssh
|
||||
index 4a5be1bd..74ffe20c 100755
|
||||
--- a/tests/fakessh/ssh
|
||||
+++ b/tests/fakessh/ssh
|
||||
@@ -62,7 +62,7 @@ prompt = "$"
|
||||
while True:
|
||||
cmd = input(prompt)
|
||||
if cmd.startswith('PS1='):
|
||||
- prompt = eval(cmd[4:]).replace('\$', '$')
|
||||
+ prompt = eval(cmd[4:]).replace(r'\$', '$')
|
||||
elif cmd == 'ping':
|
||||
print('pong')
|
||||
elif cmd.startswith('ls'):
|
93
dae602d37493bae239e0e8db5b3dabafebfd59db.patch
Normal file
93
dae602d37493bae239e0e8db5b3dabafebfd59db.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From dae602d37493bae239e0e8db5b3dabafebfd59db Mon Sep 17 00:00:00 2001
|
||||
From: Scott Talbert <swt@techie.net>
|
||||
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):
|
@ -5,12 +5,15 @@
|
||||
Name: python-%{modname}
|
||||
Summary: Unicode-aware Pure Python Expect-like module
|
||||
Version: 4.8.0
|
||||
Release: 14%{?dist}
|
||||
Release: 15%{?dist}
|
||||
|
||||
License: ISC
|
||||
URL: https://github.com/pexpect/pexpect
|
||||
Source0: %{url}/archive/%{version}/%{modname}-%{version}.tar.gz
|
||||
Patch0: %{url}/pull/715/commits/52af5b0ae0627139524448a3f2e83d9f40802bc2.patch
|
||||
Patch1: %{url}/pull/737/commits/dae602d37493bae239e0e8db5b3dabafebfd59db.patch
|
||||
Patch2: %{url}/pull/739/commits/31fab7b0edbe9b3401507b5dfa4db6aaf3fabca5.patch
|
||||
Patch3: %{url}/pull/742/commits/373679020c6b1875293bf0e3a26d3116d605bff8.patch
|
||||
|
||||
BuildRequires: /usr/bin/man
|
||||
%if %{with check}
|
||||
@ -93,6 +96,9 @@ TRAVIS=true py.test-3 --verbose
|
||||
%{python3_sitelib}/%{modname}-*.egg-info
|
||||
|
||||
%changelog
|
||||
* Sun Feb 12 2023 Scott Talbert <swt@techie.net> - 4.8.0-15
|
||||
- Fix FTBFS with Python 3.12 (#2155493)
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.8.0-14
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user