Python 3.5 is not supported for refactorings

This commit is contained in:
Dave Halter
2020-02-27 18:59:16 +01:00
parent ebdaf0177d
commit 140a45081f
3 changed files with 8 additions and 4 deletions

View File

@@ -52,12 +52,16 @@ sys.setrecursionlimit(3000)
def no_py2_support(func): def no_py2_support(func):
# TODO remove when removing Python 2 # TODO remove when removing Python 2/3.5
def wrapper(self, *args, **kwargs): def wrapper(self, *args, **kwargs):
if self._grammar.version_info.major == 2: if self._grammar.version_info.major == 2:
raise NotImplementedError( raise NotImplementedError(
"Python 2 is deprecated and won't support this feature anymore" "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 func(self, *args, **kwargs)
return wrapper return wrapper

View File

@@ -13,7 +13,7 @@ def dir_with_content(tmpdir):
return tmpdir.strpath 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( script = Script(
'import modx; modx\n', 'import modx; modx\n',
path=os.path.join(dir_with_content, 'some_script.py'), 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) ''').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') refactoring = Script('foo', path=None).rename(new_name='bar')
with pytest.raises(jedi.RefactoringError, match='on a Script with path=None'): with pytest.raises(jedi.RefactoringError, match='on a Script with path=None'):
refactoring.apply() refactoring.apply()

View File

@@ -56,7 +56,7 @@ def test_static_analysis(static_analysis_case, environment):
static_analysis_case.run(assert_static_analysis, 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. Run refactoring test case.