From 6872a07b7ed781e424f4978f1522cf0f77b5dee1812208fbe723b7c4d40c2824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Fri, 3 Jan 2025 11:04:50 +0000 Subject: [PATCH] Accepting request 1234587 from home:nkrapp:branches:devel:languages:python - Add fix-python313-tests.patch to fix tests under Python 3.13 OBS-URL: https://build.opensuse.org/request/show/1234587 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bpython?expand=0&rev=34 --- fix-python313-tests.patch | 73 +++++++++++++++++++++++++++++++++++++++ python-bpython.changes | 5 +++ python-bpython.spec | 6 ++-- 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 fix-python313-tests.patch diff --git a/fix-python313-tests.patch b/fix-python313-tests.patch new file mode 100644 index 0000000..f7b0e4a --- /dev/null +++ b/fix-python313-tests.patch @@ -0,0 +1,73 @@ +From 45f4117b534d6827279f7b9e633f3cabe0fb37e6 Mon Sep 17 00:00:00 2001 +From: Sebastian Ramacher +Date: Fri, 25 Oct 2024 17:42:20 +0200 +Subject: [PATCH] Fix test errors with Python 3.13 + +--- + bpython/test/test_interpreter.py | 17 ++++++++++++++++- + bpython/test/test_repl.py | 11 ++++++++--- + 2 files changed, 24 insertions(+), 4 deletions(-) + +Index: bpython-0.24/bpython/test/test_interpreter.py +=================================================================== +--- bpython-0.24.orig/bpython/test/test_interpreter.py ++++ bpython-0.24/bpython/test/test_interpreter.py +@@ -112,7 +112,22 @@ class TestInterpreter(unittest.TestCase) + + global_not_found = "name 'gfunc' is not defined" + +- if (3, 11) <= sys.version_info[:2]: ++ if (3, 13) <= sys.version_info[:2]: ++ expected = ( ++ "Traceback (most recent call last):\n File " ++ + green('""') ++ + ", line " ++ + bold(magenta("1")) ++ + ", in " ++ + cyan("") ++ + "\n gfunc()" ++ + "\n ^^^^^\n" ++ + bold(red("NameError")) ++ + ": " ++ + cyan(global_not_found) ++ + "\n" ++ ) ++ elif (3, 11) <= sys.version_info[:2]: + expected = ( + "Traceback (most recent call last):\n File " + + green('""') +Index: bpython-0.24/bpython/test/test_repl.py +=================================================================== +--- bpython-0.24.orig/bpython/test/test_repl.py ++++ bpython-0.24/bpython/test/test_repl.py +@@ -338,9 +338,14 @@ class TestGetSource(unittest.TestCase): + self.assert_get_source_error_for_current_function( + collections.defaultdict.copy, "No source code found for INPUTLINE" + ) +- self.assert_get_source_error_for_current_function( +- collections.defaultdict, "could not find class definition" +- ) ++ if sys.version_info[:2] >= (3, 13): ++ self.assert_get_source_error_for_current_function( ++ collections.defaultdict, "source code not available" ++ ) ++ else: ++ self.assert_get_source_error_for_current_function( ++ collections.defaultdict, "could not find class definition" ++ ) + + def test_current_line(self): + self.repl.interp.locals["a"] = socket.socket +Index: bpython-0.24/bpython/repl.py +=================================================================== +--- bpython-0.24.orig/bpython/repl.py ++++ bpython-0.24/bpython/repl.py +@@ -152,7 +152,7 @@ class Interpreter(code.InteractiveInterp + with self.timer: + return super().runsource(source, filename, symbol) + +- def showsyntaxerror(self, filename: Optional[str] = None) -> None: ++ def showsyntaxerror(self, filename: Optional[str] = None, source: Optional[str] = None) -> None: + """Override the regular handler, the code's copied and pasted from + code.py, as per showtraceback, but with the syntaxerror callback called + and the text in a pretty colour.""" diff --git a/python-bpython.changes b/python-bpython.changes index 61d3349..2e9da90 100644 --- a/python-bpython.changes +++ b/python-bpython.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jan 2 16:18:30 UTC 2025 - Nico Krapp + +- Add fix-python313-tests.patch to fix tests under Python 3.13 + ------------------------------------------------------------------- Wed Jul 26 06:58:24 UTC 2023 - Bernhard Wiedemann diff --git a/python-bpython.spec b/python-bpython.spec index 01d813a..95b0fd5 100644 --- a/python-bpython.spec +++ b/python-bpython.spec @@ -1,7 +1,7 @@ # # spec file for package python-bpython # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,6 +24,8 @@ Summary: Fancy Interface to the Python Interpreter License: MIT URL: https://www.bpython-interpreter.org/ Source: https://files.pythonhosted.org/packages/source/b/bpython/bpython-%{version}.tar.gz +# PATCH-FIX-UPSTREAM fix-python313-tests.patch from commits: gh#bbdff64 and gh#45f4117 +Patch0: fix-python313-tests.patch BuildRequires: %{python_module Babel} BuildRequires: %{python_module Sphinx} BuildRequires: %{python_module pip} @@ -40,7 +42,7 @@ Requires: python-pygments Requires: python-pyxdg Requires: python-requests Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives Recommends: python-cwcwidth Recommends: python-jedi Recommends: python-ndg-httpsclient