15
0

Accepting request 1234716 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1234716
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-bpython?expand=0&rev=17
This commit is contained in:
2025-01-03 13:18:10 +00:00
committed by Git OBS Bridge
3 changed files with 82 additions and 2 deletions

73
fix-python313-tests.patch Normal file
View File

@@ -0,0 +1,73 @@
From 45f4117b534d6827279f7b9e633f3cabe0fb37e6 Mon Sep 17 00:00:00 2001
From: Sebastian Ramacher <sebastian@ramacher.at>
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('"<input>"')
+ + ", line "
+ + bold(magenta("1"))
+ + ", in "
+ + cyan("<module>")
+ + "\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('"<input>"')
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."""

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jan 2 16:18:30 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
- Add fix-python313-tests.patch to fix tests under Python 3.13
-------------------------------------------------------------------
Wed Jul 26 06:58:24 UTC 2023 - Bernhard Wiedemann <bwiedemann@suse.com>

View File

@@ -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