From e2a28b47ee6a284fe34553b9333c4542cfcd6b05 Mon Sep 17 00:00:00 2001 From: Kaiqi Dong Date: Mon, 27 Jan 2020 13:28:09 +0100 Subject: [PATCH] Backport PR #31323: CI: Fix jedi upgrades causes deprecation warning --- pandas/tests/arrays/categorical/test_warnings.py | 12 +++++++++++- pandas/tests/indexes/test_base.py | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arrays/categorical/test_warnings.py b/pandas/tests/arrays/categorical/test_warnings.py index f66c327e9967d..9e164a250cdb1 100644 --- a/pandas/tests/arrays/categorical/test_warnings.py +++ b/pandas/tests/arrays/categorical/test_warnings.py @@ -14,6 +14,16 @@ async def test_tab_complete_warning(self, ip): code = "import pandas as pd; c = Categorical([])" await ip.run_code(code) - with tm.assert_produces_warning(None): + + # GH 31324 newer jedi version raises Deprecation warning + import jedi + + if jedi.__version__ < "0.16.0": + warning = tm.assert_produces_warning(None) + else: + warning = tm.assert_produces_warning( + DeprecationWarning, check_stacklevel=False + ) + with warning: with provisionalcompleter("ignore"): list(ip.Completer.completions("c.", 1)) diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 1047c457d6b82..eec1ea68b55e2 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -2408,7 +2408,17 @@ async def test_tab_complete_warning(self, ip): code = "import pandas as pd; idx = pd.Index([1, 2])" await ip.run_code(code) - with tm.assert_produces_warning(None): + + # GH 31324 newer jedi version raises Deprecation warning + import jedi + + if jedi.__version__ < "0.16.0": + warning = tm.assert_produces_warning(None) + else: + warning = tm.assert_produces_warning( + DeprecationWarning, check_stacklevel=False + ) + with warning: with provisionalcompleter("ignore"): list(ip.Completer.completions("idx.", 4))