From 140a45081f71aa1c69a89d442bf79918c44cc82e Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 27 Feb 2020 18:59:16 +0100 Subject: [PATCH] Python 3.5 is not supported for refactorings --- jedi/api/__init__.py | 6 +++++- test/test_api/test_refactoring.py | 4 ++-- test/test_integration.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 1e087cec..ab8e0f83 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -52,12 +52,16 @@ sys.setrecursionlimit(3000) def no_py2_support(func): - # TODO remove when removing Python 2 + # TODO remove when removing Python 2/3.5 def wrapper(self, *args, **kwargs): if self._grammar.version_info.major == 2: raise NotImplementedError( "Python 2 is deprecated and won't support this feature anymore" ) + if self._grammar.version_info[:2] == (3, 5): + raise NotImplementedError( + "No support for refactorings on Python 3.5" + ) return func(self, *args, **kwargs) return wrapper diff --git a/test/test_api/test_refactoring.py b/test/test_api/test_refactoring.py index 26ac267a..dbe430d7 100644 --- a/test/test_api/test_refactoring.py +++ b/test/test_api/test_refactoring.py @@ -13,7 +13,7 @@ def dir_with_content(tmpdir): return tmpdir.strpath -def test_rename_mod(Script, dir_with_content, skip_python2): +def test_rename_mod(Script, dir_with_content, skip_pre_python36): script = Script( 'import modx; modx\n', path=os.path.join(dir_with_content, 'some_script.py'), @@ -50,7 +50,7 @@ def test_rename_mod(Script, dir_with_content, skip_python2): ''').format(dir=dir_with_content) -def test_rename_none_path(Script, skip_python2): +def test_rename_none_path(Script, skip_pre_python36): refactoring = Script('foo', path=None).rename(new_name='bar') with pytest.raises(jedi.RefactoringError, match='on a Script with path=None'): refactoring.apply() diff --git a/test/test_integration.py b/test/test_integration.py index ad7aff6c..ba7df1a6 100644 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -56,7 +56,7 @@ def test_static_analysis(static_analysis_case, environment): static_analysis_case.run(assert_static_analysis, environment) -def test_refactor(refactor_case, skip_python2): +def test_refactor(refactor_case, skip_pre_python36): """ Run refactoring test case.