From ab36bf0e3581bb887b18624f0d585911f7fb828a Mon Sep 17 00:00:00 2001 From: Ian Thomas Date: Thu, 6 Mar 2025 13:05:44 +0000 Subject: [PATCH 1/3] Relax timings of subshell tests --- tests/test_subshells.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_subshells.py b/tests/test_subshells.py index 889df1b2e..557ee6a73 100644 --- a/tests/test_subshells.py +++ b/tests/test_subshells.py @@ -143,7 +143,7 @@ def test_run_concurrently_sequence(are_subshells, overlap): kc, "import threading as t, time; b=t.Barrier(2); print('ok')", None ) - sleep = 0.2 + sleep = 0.5 if overlap: codes = [ f"b.wait(); start0=True; end0=False; time.sleep({sleep}); end0=True", @@ -186,7 +186,7 @@ def test_run_concurrently_timing(include_main_shell): kc, "import threading as t, time; b=t.Barrier(2); print('ok')", None ) - times = (0.2, 0.2) + times = (0.5, 0.5) # Prepare messages, times are sleep times in seconds. # Identical times for both subshells is a harder test as preparing and sending # the execute_reply messages may overlap. @@ -230,7 +230,7 @@ def test_execution_count(): ) # Prepare messages - times = (0.2, 0.1, 0.4, 0.15) # Sleep seconds + times = (0.4, 0.2, 0.8, 0.3) # Sleep seconds msgs = [] for i, (id, sleep) in enumerate(zip((None, subshell_id, None, subshell_id), times)): code = f"b.wait(); time.sleep({sleep})" if i < 2 else f"time.sleep({sleep})" From c5ebadbc6d316968b1bf6891e44228c4351d939b Mon Sep 17 00:00:00 2001 From: Ian Thomas Date: Tue, 11 Mar 2025 13:59:25 +0000 Subject: [PATCH 2/3] Precommit fixes --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fbfbcd46..a41e3bc99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,15 +29,15 @@ - Fix expected text depending on IPython version. [#1354](https://github.com/ipython/ipykernel/pull/1354) ([@Carreau](https://github.com/Carreau)) - Another try at tracking down ResourceWarning with tracemalloc. [#1353](https://github.com/ipython/ipykernel/pull/1353) ([@Carreau](https://github.com/Carreau)) - Remove deprecated modules since 4.3 (2016). [#1352](https://github.com/ipython/ipykernel/pull/1352) ([@Carreau](https://github.com/Carreau)) -- Try to reenable tests from downstream ipywidgets [#1350](https://github.com/ipython/ipykernel/pull/1350) ([@Carreau](https://github.com/Carreau)) +- Try to re-enable tests from downstream ipywidgets [#1350](https://github.com/ipython/ipykernel/pull/1350) ([@Carreau](https://github.com/Carreau)) - Disable 3 failing downstream tests, but keep testing the rest. [#1349](https://github.com/ipython/ipykernel/pull/1349) ([@Carreau](https://github.com/Carreau)) -- Licence :: * trove classifers are deprecated [#1348](https://github.com/ipython/ipykernel/pull/1348) ([@Carreau](https://github.com/Carreau)) +- Licence :: * trove classifiers are deprecated [#1348](https://github.com/ipython/ipykernel/pull/1348) ([@Carreau](https://github.com/Carreau)) - Pin sphinx to resolve docs build failures [#1347](https://github.com/ipython/ipykernel/pull/1347) ([@krassowski](https://github.com/krassowski)) - Make our own mock kernel methods async [#1346](https://github.com/ipython/ipykernel/pull/1346) ([@Carreau](https://github.com/Carreau)) - Try to debug non-closed iopub socket [#1345](https://github.com/ipython/ipykernel/pull/1345) ([@Carreau](https://github.com/Carreau)) - Email is @python.org since 2018 [#1343](https://github.com/ipython/ipykernel/pull/1343) ([@Carreau](https://github.com/Carreau)) - Remove unused ignores lints. [#1342](https://github.com/ipython/ipykernel/pull/1342) ([@Carreau](https://github.com/Carreau)) -- Enable ruff G002 and fix 6 occurences [#1341](https://github.com/ipython/ipykernel/pull/1341) ([@Carreau](https://github.com/Carreau)) +- Enable ruff G002 and fix 6 occurrences [#1341](https://github.com/ipython/ipykernel/pull/1341) ([@Carreau](https://github.com/Carreau)) - Check ignores warnings are still relevant. [#1340](https://github.com/ipython/ipykernel/pull/1340) ([@Carreau](https://github.com/Carreau)) - Move mypy disablinging error codes on a per-file basis [#1338](https://github.com/ipython/ipykernel/pull/1338) ([@Carreau](https://github.com/Carreau)) - try to fix spyder kernel install [#1337](https://github.com/ipython/ipykernel/pull/1337) ([@Carreau](https://github.com/Carreau)) @@ -46,7 +46,7 @@ - Bump mypy [#1333](https://github.com/ipython/ipykernel/pull/1333) ([@Carreau](https://github.com/Carreau)) - Remove dead code. [#1332](https://github.com/ipython/ipykernel/pull/1332) ([@Carreau](https://github.com/Carreau)) - Ignore or fix most of the remaining ruff 0.9.6 errors [#1331](https://github.com/ipython/ipykernel/pull/1331) ([@Carreau](https://github.com/Carreau)) -- minor code reformating valid ruff 0.9.6 [#1330](https://github.com/ipython/ipykernel/pull/1330) ([@Carreau](https://github.com/Carreau)) +- minor code reformatting valid ruff 0.9.6 [#1330](https://github.com/ipython/ipykernel/pull/1330) ([@Carreau](https://github.com/Carreau)) - Some formatting changes to prepare bumping ruff pre-commit. [#1329](https://github.com/ipython/ipykernel/pull/1329) ([@Carreau](https://github.com/Carreau)) - Manually update Codespell and fix new errors. [#1328](https://github.com/ipython/ipykernel/pull/1328) ([@Carreau](https://github.com/Carreau)) - Manually update mdformat pre-commit and run it. [#1327](https://github.com/ipython/ipykernel/pull/1327) ([@Carreau](https://github.com/Carreau)) From 817cdf17e8ffb8cbb2338a968435c5a40d2cdf4c Mon Sep 17 00:00:00 2001 From: Ian Thomas Date: Wed, 12 Mar 2025 12:24:01 +0000 Subject: [PATCH 3/3] Skip time-sensitive subshell tests if measuring coverage --- tests/test_subshells.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_subshells.py b/tests/test_subshells.py index 557ee6a73..056617d09 100644 --- a/tests/test_subshells.py +++ b/tests/test_subshells.py @@ -130,7 +130,10 @@ def test_thread_ids(): ) @pytest.mark.parametrize("are_subshells", [(False, True), (True, False), (True, True)]) @pytest.mark.parametrize("overlap", [True, False]) -def test_run_concurrently_sequence(are_subshells, overlap): +def test_run_concurrently_sequence(are_subshells, overlap, request): + if request.config.getvalue("--cov"): + pytest.skip("Skip time-sensitive subshell tests if measuring coverage") + with new_kernel() as kc: subshell_ids = [ create_subshell_helper(kc)["subshell_id"] if is_subshell else None @@ -173,7 +176,10 @@ def test_run_concurrently_sequence(are_subshells, overlap): @pytest.mark.parametrize("include_main_shell", [True, False]) -def test_run_concurrently_timing(include_main_shell): +def test_run_concurrently_timing(include_main_shell, request): + if request.config.getvalue("--cov"): + pytest.skip("Skip time-sensitive subshell tests if measuring coverage") + with new_kernel() as kc: subshell_ids = [ None if include_main_shell else create_subshell_helper(kc)["subshell_id"],