Skip to content

Commit

Permalink
Ensure test run with python2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
galaunay committed Oct 4, 2020
1 parent a418dc0 commit a90d579
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 3 additions & 2 deletions elpy/jedibackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,9 @@ def run_with_debug(jedi, name, fun_kwargs={}, *args, **kwargs):
except Exception as e:
if isinstance(e, re_raise):
raise
if isinstance(e, jedi.RefactoringError):
return None
if JEDISUP17:
if isinstance(e, jedi.RefactoringError):
return None
# Bug jedi#485
if (
isinstance(e, ValueError) and
Expand Down
22 changes: 20 additions & 2 deletions elpy/tests/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from elpy.tests import compat
from elpy.rpc import Fault
from elpy import jedibackend


class BackendTestCase(unittest.TestCase):
Expand Down Expand Up @@ -634,8 +635,9 @@ class RPCGetAssignmentTests():
METHOD = "rpc_get_assignment"

def test_should_raise_fault(self):
with self.assertRaises(Fault):
self.backend.rpc_get_assignment("test.py", "dummy code", 1)
if jedibackend.JEDISUP17:
with self.assertRaises(Fault):
self.backend.rpc_get_assignment("test.py", "dummy code", 1)

def test_should_handle_jedi16(self):
backup = self.backend.rpc_get_assignment
Expand Down Expand Up @@ -908,6 +910,10 @@ def test_should_handle_jedi16(self):
self.backend.rpc_get_oneline_docstring = backup


@unittest.skipIf(not jedibackend.JEDISUP17,
"Refactoring not available with jedi<17")
@unittest.skipIf(sys.version_info < (3, 6),
"Jedi refactoring not available for python < 3.6")
class RPCGetRenameDiffTests(object):
METHOD = "rpc_get_rename_diff"

Expand Down Expand Up @@ -935,6 +941,10 @@ def test_should_fail_for_invalid_symbol_at_point(self):
self.assertFalse(diff['success'])


@unittest.skipIf(not jedibackend.JEDISUP17,
"Refactoring not available with jedi<17")
@unittest.skipIf(sys.version_info < (3, 6),
"Jedi refactoring not available for python < 3.6")
class RPCGetExtractFunctionDiffTests(object):
METHOD = "rpc_get_extract_function_diff"

Expand All @@ -956,6 +966,10 @@ def test_should_return_function_extraction_diff(self):
diff['diff'])


@unittest.skipIf(not jedibackend.JEDISUP17,
"Refactoring not available with jedi<17")
@unittest.skipIf(sys.version_info < (3, 6),
"Jedi refactoring not available for python < 3.6")
class RPCGetExtractVariableDiffTests(object):
METHOD = "rpc_get_extract_variable_diff"

Expand All @@ -974,6 +988,10 @@ def test_should_return_variable_extraction_diff(self):
diff['diff'])


@unittest.skipIf(not jedibackend.JEDISUP17,
"Refactoring not available with jedi<17")
@unittest.skipIf(sys.version_info < (3, 6),
"Jedi refactoring not available for python < 3.6")
class RPCGetInlineDiffTests(object):
METHOD = "rpc_get_inline_diff"

Expand Down

0 comments on commit a90d579

Please sign in to comment.