From 8e4e46d9041eea4a155da99354b3998905fad693 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 23 Mar 2026 21:44:21 -0500 Subject: [PATCH] Speed up CI test suite on non-Linux platforms - Skip slow ipcluster-dependent parallel magic tests on non-Linux CI - Skip slow matplotlib backend test on non-Linux CI - Reduce pexpect timeout test from 5s to 1s - Reduce bash sleep in CR-handling tests from 1s to 0.1s --- tests/magics/test_matplotlib_magic.py | 2 ++ tests/magics/test_parallel_magic.py | 7 ++++++- tests/test_expect.py | 2 +- tests/test_process_metakernel.py | 2 +- tests/test_replwrap.py | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/magics/test_matplotlib_magic.py b/tests/magics/test_matplotlib_magic.py index 196896e8..f47eeb59 100644 --- a/tests/magics/test_matplotlib_magic.py +++ b/tests/magics/test_matplotlib_magic.py @@ -1,5 +1,6 @@ import asyncio import importlib.util +import sys import pytest @@ -20,6 +21,7 @@ def restore_ipython_display(): IPython.display.display = original +@pytest.mark.skipif(sys.platform != "linux", reason="Too slow on non-Linux CI") def test_matplotlib_magic_sets_backend() -> None: """%matplotlib sets the matplotlib backend.""" import matplotlib diff --git a/tests/magics/test_parallel_magic.py b/tests/magics/test_parallel_magic.py index e2ff354a..1cb145a1 100644 --- a/tests/magics/test_parallel_magic.py +++ b/tests/magics/test_parallel_magic.py @@ -17,7 +17,9 @@ @pytest.mark.skipif(ipyparallel is None, reason="Requires ipyparallel") -@pytest.mark.skipif(sys.platform == "darwin", reason="Fails on darwin") +@pytest.mark.skipif( + sys.platform != "linux", reason="Requires ipcluster; too slow on non-Linux CI" +) def test_parallel_magic() -> None: kernel = get_kernel(EvalKernel) # start up an EvalKernel on each node: @@ -31,6 +33,9 @@ def test_parallel_magic() -> None: @pytest.mark.skipif(ipyparallel is None, reason="Requires ipyparallel") +@pytest.mark.skipif( + sys.platform != "linux", reason="Requires ipcluster; too slow on non-Linux CI" +) def test_px_error_reports_exception_not_noisy_traceback() -> None: """%%px with failing code should report the remote error, not a noisy 'Error in calling magic' wrapper with full Python traceback (issue #61).""" diff --git a/tests/test_expect.py b/tests/test_expect.py index 6d46256a..6c679a2a 100644 --- a/tests/test_expect.py +++ b/tests/test_expect.py @@ -160,7 +160,7 @@ def test_expect_eof(self) -> None: assert the_old_way == the_new_way, hex_diff(the_old_way, the_new_way) def test_expect_timeout(self) -> None: - p = pexpect.spawn("cat", timeout=5) + p = pexpect.spawn("cat", timeout=1) p.expect(pexpect.TIMEOUT) # This tells it to wait for timeout. self.assertEqual(p.after, pexpect.TIMEOUT) diff --git a/tests/test_process_metakernel.py b/tests/test_process_metakernel.py index 747ab42d..6c00c5ed 100755 --- a/tests/test_process_metakernel.py +++ b/tests/test_process_metakernel.py @@ -32,7 +32,7 @@ def test_process_metakernel() -> None: kernel.Display(html) asyncio.run( - kernel.do_execute(r'for i in {1..3};do echo -ne "$i\r"; sleep 1; done', None) + kernel.do_execute(r'for i in {1..3};do echo -ne "$i\r"; sleep 0.1; done', None) ) text = get_log_text(kernel) assert r"1\r2\r3\r" in text diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py index dd8ac1d7..5b41b389 100644 --- a/tests/test_replwrap.py +++ b/tests/test_replwrap.py @@ -37,7 +37,7 @@ def test_bash(self) -> None: assert "SLEEP" in res, res # should handle CR by default - cmd = r'for i in {1..3};do echo -ne "\r$i"; sleep 1; done' + cmd = r'for i in {1..3};do echo -ne "\r$i"; sleep 0.1; done' res = bash.run_command(cmd) assert "\r1\r2\r3" in res