From e63a8bbaa6a458d749ed275140ae55ecbc906154 2021-11-15 19:03:09 From: Nikita Kniazev Date: 2021-11-15 19:03:09 Subject: [PATCH] Workaround Jedi Python 3.10 issue --- diff --git a/IPython/core/tests/test_completer.py b/IPython/core/tests/test_completer.py index 61e1d35..7ef4892 100644 --- a/IPython/core/tests/test_completer.py +++ b/IPython/core/tests/test_completer.py @@ -26,6 +26,15 @@ from IPython.core.completer import ( _deduplicate_completions, ) +if sys.version_info >= (3, 10): + import jedi + from pkg_resources import parse_version + + # Requires https://github.com/davidhalter/jedi/pull/1795 + jedi_issue = parse_version(jedi.__version__) <= parse_version("0.18.0") +else: + jedi_issue = False + # ----------------------------------------------------------------------------- # Test functions # ----------------------------------------------------------------------------- @@ -442,6 +451,8 @@ class TestCompleter(unittest.TestCase): matches = c.all_completions("TestCl") assert matches == ['TestClass'], jedi_status matches = c.all_completions("TestClass.") + if jedi_status and jedi_issue: + continue assert len(matches) > 2, jedi_status matches = c.all_completions("TestClass.a") assert matches == ['TestClass.a', 'TestClass.a1'], jedi_status @@ -496,6 +507,7 @@ class TestCompleter(unittest.TestCase): "encoding" in c.signature ), "Signature of function was not found by completer" + @pytest.mark.xfail(jedi_issue, reason="Known failure on jedi<=0.18.0") def test_deduplicate_completions(self): """ Test that completions are correctly deduplicated (even if ranges are not the same)