Package: ipython
Version: 8.20.0-1
Followup-For: Bug #1063945
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: origin-ubuntu oracular ubuntu-patch
Control: tags -1 patch
Hi,
I identified two patches from upstream that solved this issue but
aren't available in the currently packaged version. I applied the
following in Ubuntu to solve the issue:
* Update pytest and tests for pytest 8 compatibility (LP: #2068674).
- d/p/pytest8-nose-tests.patch: update nose-style tests for pytest 8.2+
- d/p/support-pytest-plugin.patch: update pytest plugin for pytest 8.1+
Thanks for considering the patches.
-- System Information:
Debian Release: trixie/sid
APT prefers oracular
APT policy: (500, 'oracular'), (100, 'oracular-proposed')
Architecture: amd64 (x86_64)
Kernel: Linux 6.8.0-31-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru ipython-8.20.0/debian/patches/pytest8-nose-tests.patch
ipython-8.20.0/debian/patches/pytest8-nose-tests.patch
--- ipython-8.20.0/debian/patches/pytest8-nose-tests.patch 1969-12-31
16:00:00.000000000 -0800
+++ ipython-8.20.0/debian/patches/pytest8-nose-tests.patch 2024-06-06
17:10:18.000000000 -0700
@@ -0,0 +1,32 @@
+Description: Update nose-style tests for pytest 8 compatbility
+ Pytest dropped support for nose-style tests in pytest 8. This patch cherry-
+ picks the patch from upstream to fix the offending tests. This patch can
+ be dropped in version 8.24.0.
+Author: Chris Peterson <[email protected]>
+Origin: upstream,
https://github.com/ipython/ipython/commit/cdacafdccaf1f562e59b21b3c9f2c1a28eba54da
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ipython/+bug/2068674
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1063945
+Forwarded: not-needed
+Last-Update: 2024-06-06
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/IPython/core/tests/test_pylabtools.py
++++ b/IPython/core/tests/test_pylabtools.py
+@@ -165,7 +165,7 @@
+ def enable_gui(self, gui):
+ pass
+
+- def setup(self):
++ def setup_method(self):
+ import matplotlib
+ def act_mpl(backend):
+ matplotlib.rcParams['backend'] = backend
+@@ -184,7 +184,7 @@
+ self._save_cis = backend_inline.configure_inline_support
+ backend_inline.configure_inline_support = lambda *a, **kw: None
+
+- def teardown(self):
++ def teardown_method(self):
+ pt.activate_matplotlib = self._save_am
+ pt.import_pylab = self._save_ip
+ backend_inline.configure_inline_support = self._save_cis
diff -Nru ipython-8.20.0/debian/patches/series
ipython-8.20.0/debian/patches/series
--- ipython-8.20.0/debian/patches/series 2024-01-14 16:32:19.000000000
-0800
+++ ipython-8.20.0/debian/patches/series 2024-06-06 17:10:38.000000000
-0700
@@ -1,2 +1,4 @@
0002-Update-intersphinx-links-for-local-access.patch
0003-Drop-setuptools-data_files.patch
+pytest8-nose-tests.patch
+support-pytest-plugin.patch
diff -Nru ipython-8.20.0/debian/patches/support-pytest-plugin.patch
ipython-8.20.0/debian/patches/support-pytest-plugin.patch
--- ipython-8.20.0/debian/patches/support-pytest-plugin.patch 1969-12-31
16:00:00.000000000 -0800
+++ ipython-8.20.0/debian/patches/support-pytest-plugin.patch 2024-06-06
17:22:13.000000000 -0700
@@ -0,0 +1,120 @@
+Description: Update pytest plugin for pytest 8
+ Pytest 8.1 changed the plugin API. This patch cherry-picks the upstream
+ modifications to the plugin for pytest 8.1+ support. This patch can be
+ dropped with upstream version 8.25.0.
+Author: Chris Peterson <[email protected]>
+Origin: upstream,
https://github.com/ipython/ipython/commit/7df70a3cd79068be6f98596e427d60a5d0cfe5b3
+Bug: https://github.com/ipython/ipython/issues/14390
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ipython/+bug/2068674
+Forwarded: not-needed
+Last-Update: 2024-06-06
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/IPython/testing/plugin/pytest_ipdoctest.py
++++ b/IPython/testing/plugin/pytest_ipdoctest.py
+@@ -38,7 +38,11 @@
+ from _pytest.compat import safe_getattr
+ from _pytest.config import Config
+ from _pytest.config.argparsing import Parser
+-from _pytest.fixtures import FixtureRequest
++
++try:
++ from _pytest.fixtures import TopRequest as FixtureRequest
++except ImportError:
++ from _pytest.fixtures import FixtureRequest
+ from _pytest.nodes import Collector
+ from _pytest.outcomes import OutcomeException
+ from _pytest.pathlib import fnmatch_ex
+@@ -68,6 +72,8 @@
+ # Lazy definition of output checker class
+ CHECKER_CLASS: Optional[Type["IPDoctestOutputChecker"]] = None
+
++pytest_version = tuple([int(part) for part in pytest.__version__.split(".")])
++
+
+ def pytest_addoption(parser: Parser) -> None:
+ parser.addini(
+@@ -142,7 +148,7 @@
+ return None
+
+
+-if int(pytest.__version__.split(".")[0]) < 7:
++if pytest_version[0] < 7:
+ _collect_file = pytest_collect_file
+
+ def pytest_collect_file(
+@@ -444,7 +450,7 @@
+ assert self.dtest is not None
+ return self.path, self.dtest.lineno, "[ipdoctest] %s" % self.name
+
+- if int(pytest.__version__.split(".")[0]) < 7:
++ if pytest_version[0] < 7:
+
+ @property
+ def path(self) -> Path:
+@@ -517,7 +523,7 @@
+ self, name=test.name, runner=runner, dtest=test
+ )
+
+- if int(pytest.__version__.split(".")[0]) < 7:
++ if pytest_version[0] < 7:
+
+ @property
+ def path(self) -> Path:
+@@ -632,20 +638,26 @@
+ )
+
+ if self.path.name == "conftest.py":
+- if int(pytest.__version__.split(".")[0]) < 7:
++ if pytest_version[0] < 7:
+ module = self.config.pluginmanager._importconftest(
+ self.path,
+ self.config.getoption("importmode"),
+ )
+ else:
++ kwargs = {"rootpath": self.config.rootpath}
++ if pytest_version >= (8, 1):
++ kwargs["consider_namespace_packages"] = False
+ module = self.config.pluginmanager._importconftest(
+ self.path,
+ self.config.getoption("importmode"),
+- rootpath=self.config.rootpath,
++ **kwargs,
+ )
+ else:
+ try:
+- module = import_path(self.path, root=self.config.rootpath)
++ kwargs = {"root": self.config.rootpath}
++ if pytest_version >= (8, 1):
++ kwargs["consider_namespace_packages"] = False
++ module = import_path(self.path, **kwargs)
+ except ImportError:
+ if self.config.getvalue("ipdoctest_ignore_import_errors"):
+ pytest.skip("unable to import module %r" % self.path)
+@@ -667,7 +679,7 @@
+ self, name=test.name, runner=runner, dtest=test
+ )
+
+- if int(pytest.__version__.split(".")[0]) < 7:
++ if pytest_version[0] < 7:
+
+ @property
+ def path(self) -> Path:
+@@ -697,11 +709,15 @@
+
+ doctest_item.funcargs = {} # type: ignore[attr-defined]
+ fm = doctest_item.session._fixturemanager
++ kwargs = {"node": doctest_item, "func": func, "cls": None}
++ if pytest_version <= (8, 0):
++ kwargs["funcargs"] = False
+ doctest_item._fixtureinfo = fm.getfixtureinfo( # type:
ignore[attr-defined]
+- node=doctest_item, func=func, cls=None, funcargs=False
++ **kwargs
+ )
+ fixture_request = FixtureRequest(doctest_item, _ispytest=True)
+- fixture_request._fillfixtures()
++ if pytest_version <= (8, 0):
++ fixture_request._fillfixtures()
+ return fixture_request
+
+