diff --git a/IPython/core/tests/test_completer.py b/IPython/core/tests/test_completer.py index e2e6ec0..87c561d 100644 --- a/IPython/core/tests/test_completer.py +++ b/IPython/core/tests/test_completer.py @@ -10,6 +10,9 @@ import sys import textwrap import unittest +from importlib.metadata import version + + from contextlib import contextmanager from traitlets.config.loader import Config @@ -30,6 +33,9 @@ from IPython.core.completer import ( CompletionContext, ) +from packaging.version import parse + + # ----------------------------------------------------------------------------- # Test functions # ----------------------------------------------------------------------------- @@ -531,7 +537,11 @@ class TestCompleter(unittest.TestCase): c = next(completions) # should be `%time` or similar assert c.type == "magic", "Type of magic was not assigned by completer" - @pytest.mark.xfail(reason="Known failure on jedi<=0.18.0") + @pytest.mark.xfail( + parse(version("jedi")) <= parse("0.18.0"), + reason="Known failure on jedi<=0.18.0", + strict=True, + ) def test_deduplicate_completions(self): """ Test that completions are correctly deduplicated (even if ranges are not the same) diff --git a/IPython/core/tests/test_debugger.py b/IPython/core/tests/test_debugger.py index 82c57b2..b22be92 100644 --- a/IPython/core/tests/test_debugger.py +++ b/IPython/core/tests/test_debugger.py @@ -447,6 +447,11 @@ def test_decorator_skip_disabled(): child.close() +@pytest.mark.xfail( + sys.version_info.releaselevel not in ("final", "candidate"), + reason="fails on 3.13.dev", + strict=True, +) @pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="issues on PyPy") @skip_win32 def test_decorator_skip_with_breakpoint(): diff --git a/IPython/core/tests/test_oinspect.py b/IPython/core/tests/test_oinspect.py index 8d65941..3decb8b 100644 --- a/IPython/core/tests/test_oinspect.py +++ b/IPython/core/tests/test_oinspect.py @@ -488,7 +488,12 @@ def test_pinfo_docstring_if_detail_and_no_source(): ip._inspect('pinfo', 'foo.bar', detail_level=1) -def test_pinfo_docstring_dynamic(): +@pytest.mark.xfail( + sys.version_info.releaselevel not in ("final", "candidate"), + reason="fails on 3.13.dev", + strict=True, +) +def test_pinfo_docstring_dynamic(capsys): obj_def = """class Bar: __custom_documentations__ = { "prop" : "cdoc for prop", @@ -509,20 +514,25 @@ def test_pinfo_docstring_dynamic(): ip.run_cell("b = Bar()") - with AssertPrints("Docstring: cdoc for prop"): - ip.run_line_magic("pinfo", "b.prop") + ip.run_line_magic("pinfo", "b.prop") + captured = capsys.readouterr() + assert "Docstring: cdoc for prop" in captured.out - with AssertPrints("Docstring: cdoc for non_exist"): - ip.run_line_magic("pinfo", "b.non_exist") + ip.run_line_magic("pinfo", "b.non_exist") + captured = capsys.readouterr() + assert "Docstring: cdoc for non_exist" in captured.out - with AssertPrints("Docstring: cdoc for prop"): - ip.run_cell("b.prop?") + ip.run_cell("b.prop?") + captured = capsys.readouterr() + assert "Docstring: cdoc for prop" in captured.out - with AssertPrints("Docstring: cdoc for non_exist"): - ip.run_cell("b.non_exist?") + ip.run_cell("b.non_exist?") + captured = capsys.readouterr() + assert "Docstring: cdoc for non_exist" in captured.out - with AssertPrints("Docstring: "): - ip.run_cell("b.undefined?") + ip.run_cell("b.undefined?") + captured = capsys.readouterr() + assert "Docstring: " in captured.out def test_pinfo_magic(): diff --git a/pyproject.toml b/pyproject.toml index d6cf19b..1dfda30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,6 +99,7 @@ test = [ "pytest-asyncio<0.22", "testpath", "pickleshare", + "packaging", ] test_extra = [ "ipython[test]",