public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Charalampos Stratakis <cstratak@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/Cython] rawhide: CI: Fix issues with ipython tests and add them back to the CI
Date: Wed, 24 Jun 2026 16:03:18 GMT [thread overview]
Message-ID: <178231699888.1.10301781435681244847.rpms-Cython-9f71229ee50f@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/Cython
Branch : rawhide
Commit : 9f71229ee50f7cc5222a45029753f76d95fd8c5c
Author : Charalampos Stratakis <cstratak@redhat.com>
Date : 2026-06-24T02:12:26+02:00
Stats : +110/-1 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/Cython/c/9f71229ee50f7cc5222a45029753f76d95fd8c5c?branch=rawhide
Log:
CI: Fix issues with ipython tests and add them back to the CI
[skip changelog]
---
diff --git a/Cython.spec b/Cython.spec
index b5d92ee..4a834ee 100644
--- a/Cython.spec
+++ b/Cython.spec
@@ -13,6 +13,10 @@ License: Apache-2.0
URL: http://www.cython.org
Source: https://github.com/cython/cython/archive/%{version}/Cython-%{version}.tar.gz
+# Fix issues with the ipython tests
+# Resolved upstream: https://github.com/cython/cython/pull/7553
+Patch: fix-ipython-tests.patch
+
BuildRequires: python3-devel
%if %{with tests}
diff --git a/fix-ipython-tests.patch b/fix-ipython-tests.patch
new file mode 100644
index 0000000..39c5370
--- /dev/null
+++ b/fix-ipython-tests.patch
@@ -0,0 +1,105 @@
+From cc7eba1894beae94288a963b76ce89d7c1eff1a7 Mon Sep 17 00:00:00 2001
+From: scoder <stefan_ml@behnel.de>
+Date: Fri, 6 Mar 2026 23:15:05 +0100
+Subject: [PATCH] Tests: Clean up builtins after running IPython tests
+ (GH-7553)
+
+If useful in more places, most of this can be moved into CythonTest.
+
+Closes https://github.com/cython/cython/issues/7075
+Supersedes https://github.com/cython/cython/pull/7078
+---
+ Cython/Build/Tests/TestIpythonMagic.py | 54 +++++++++++++++++---------
+ 1 file changed, 35 insertions(+), 19 deletions(-)
+
+diff --git a/Cython/Build/Tests/TestIpythonMagic.py b/Cython/Build/Tests/TestIpythonMagic.py
+index 86f5c1a059b..7036ef10f83 100644
+--- a/Cython/Build/Tests/TestIpythonMagic.py
++++ b/Cython/Build/Tests/TestIpythonMagic.py
+@@ -3,36 +3,21 @@
+ """Tests for the Cython magics extension."""
+
+
++import builtins
+ import os
+ import io
+ import sys
+ from contextlib import contextmanager
+-from unittest import skipIf
++from unittest import skipIf, SkipTest
+
+ from Cython.Build import IpythonMagic
+ from Cython.TestUtils import CythonTest
+ from Cython.Compiler.Annotate import AnnotationCCodeWriter
+
+-try:
+- import IPython.testing.globalipapp
+-except ImportError:
+- # Disable tests and fake helpers for initialisation below.
+- def skip_if_not_installed(_):
+- return None
+-else:
+- def skip_if_not_installed(c):
+- return c
+
+ # not using IPython's decorators here because they depend on "nose"
+ skip_win32 = skipIf(sys.platform == 'win32', "Skip on Windows")
+
+-try:
+- # disable IPython history thread before it gets started to avoid having to clean it up
+- from IPython.core.history import HistoryManager
+- HistoryManager.enabled = False
+-except ImportError:
+- pass
+-
+
+ @contextmanager
+ def capture_output():
+@@ -94,14 +79,45 @@ def doit():
+ '''
+
+
+-@skip_if_not_installed
+ class TestIPythonMagic(CythonTest):
++ _orig_builtins = None
+
+ @classmethod
+ def setUpClass(cls):
+- CythonTest.setUpClass()
++ super().setUpClass()
++
++ # IPython modifies the builtins, so keep a clean copy before the import.
++ orig_builtins = dict(builtins.__dict__)
++
++ try:
++ import IPython.testing.globalipapp
++ except ImportError as exc:
++ # Disable tests and fake helpers for initialisation below.
++ raise SkipTest(f"IPython is not installed: {exc}")
++
++ try:
++ # disable IPython history thread before it gets started to avoid having to clean it up
++ from IPython.core.history import HistoryManager
++ HistoryManager.enabled = False
++ except ImportError:
++ pass
++
++ cls._orig_builtins = orig_builtins
+ cls._ip = IPython.testing.globalipapp.get_ipython()
+
++ @classmethod
++ def tearDownClass(cls):
++ # Clean up builtins from IPython left-overs.
++ if cls._orig_builtins:
++ for name in list(vars(builtins)):
++ if name not in cls._orig_builtins:
++ delattr(builtins, name)
++ for name, value in cls._orig_builtins.items():
++ if getattr(builtins, name, None) is not value:
++ setattr(builtins, name, value)
++
++ super().tearDownClass()
++
+ def setUp(self):
+ CythonTest.setUp(self)
+ self._ip.extension_manager.load_extension('cython')
diff --git a/tests/testsuite/main.fmf b/tests/testsuite/main.fmf
index a9e6dd5..80afcf4 100644
--- a/tests/testsuite/main.fmf
+++ b/tests/testsuite/main.fmf
@@ -14,7 +14,7 @@ require:
# ipython and pythran installed from PyPI, not available in RHEL
# Add ipython again when upstream resolves https://github.com/cython/cython/issues/7075
test: |
- pip install pythran==0.18.1 &&
+ pip install ipython==9.14.1 pythran==0.18.1 &&
cd $(dirname $TMT_SOURCE_DIR/cython-*/tests) &&
python3 runtests.py -vv --no-pyregr --exclude 'run.pstats_profile_test*'
duration: 240m
reply other threads:[~2026-06-24 16:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178231699888.1.10301781435681244847.rpms-Cython-9f71229ee50f@fedoraproject.org \
--to=cstratak@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox