Subject: [bug#50074] [PATCH core-updates-frozen] gnu: bpython: Fix test failure.

From: Noah Evans <[email-masked]>
Date: Mon, 16 Aug 2021 02:41:20 +0000

Updating jedi causes a bpython test to fail. I attached a patch backporting the required bpython changes. Alternatively, bpython's version could be bumped, or jedi could be removed from its dependencies.

From d2611d5a1afe83ad16a8d0b1810c340a765d6284 Mon Sep 17 00:00:00 2001
From: Noah Evans <[email-masked]>
Date: Sun, 15 Aug 2021 22:20:00 -0400
Subject: [[PATCH core-updates-frozen]] gnu: bpython: Fix test failure.

---
.../patches/bpython-jedi-update.patch | 32 +++++++++++++++++++
gnu/packages/python-xyz.scm | 3 +-
2 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/bpython-jedi-update.patch

diff --git a/gnu/packages/patches/bpython-jedi-update.patch b/gnu/packages/patches/bpython-jedi-update.patch
new file mode 100644
index 0000000000..dee648d83e
--- /dev/null
+++ b/gnu/packages/patches/bpython-jedi-update.patch
@@ -0,0 +1,32 @@
+Taken from this commit on bpython: https://github.com/bpython/bpython/commit/1cfba80da898c54334521318e232f0d31cac7051
+
+diff --git a/bpython/autocomplete.py b/bpython/autocomplete.py
+index b0508bc9..a06776f6 100644
+--- a/bpython/autocomplete.py
++++ b/bpython/autocomplete.py
+@@ -520,9 +520,9 @@ def matches(self, cursor_offset, line, **kwargs):
+
+ try:
+ script = jedi.Script(
+- history, len(history.splitlines()), cursor_offset, "fake.py"
++ history, path="fake.py"
+ )
+- completions = script.completions()
++ completions = script.complete(len(history.splitlines()), cursor_offset)
+ except (jedi.NotFoundError, IndexError, KeyError):
+ # IndexError for #483
+ # KeyError for #544
+diff --git a/bpython/test/test_autocomplete.py b/bpython/test/test_autocomplete.py
+index 65beb011..28243577 100644
+--- a/bpython/test/test_autocomplete.py
++++ b/bpython/test/test_autocomplete.py
+@@ -367,7 +367,7 @@ def matches_from_completions(
+ ):
+ with mock.patch("bpython.autocomplete.jedi.Script") as Script:
+ script = Script.return_value
+- script.completions.return_value = completions
++ script.complete.return_value = completions
+ com = autocomplete.MultilineJediCompletion()
+ return com.matches(
+ cursor, line, current_block=block, history=history
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c8b3777f8f..2a86d2bb3c 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -20015,7 +20015,8 @@ Included are implementations of:
(method url-fetch)
(uri (pypi-uri "bpython" version))
(sha256
- (base32 "00vmkkc79mlnkyvwww1cr7bpwmf4p61704dhayz6kd0kc203hxvf"))))
+ (base32 "00vmkkc79mlnkyvwww1cr7bpwmf4p61704dhayz6kd0kc203hxvf"))
+ (patches (search-patches "bpython-jedi-update.patch"))))
(build-system python-build-system)
(arguments
`(#:phases
--
2.32.0