1
0
forked from VimPlug/jedi

Remove the skip_python2 fixture

This commit is contained in:
Dave Halter
2020-07-02 02:52:02 +02:00
parent f4e537fd72
commit 188fdcd34f
9 changed files with 9 additions and 27 deletions

View File

@@ -144,14 +144,6 @@ def jedi_path():
return os.path.dirname(__file__) return os.path.dirname(__file__)
@pytest.fixture()
def skip_python2(environment):
if environment.version_info.major == 2:
# This if is just needed to avoid that tests ever skip way more than
# they should for all Python versions.
pytest.skip()
@pytest.fixture() @pytest.fixture()
def skip_pre_python38(environment): def skip_pre_python38(environment):
if environment.version_info < (3, 8): if environment.version_info < (3, 8):

View File

@@ -50,14 +50,6 @@ Arch Linux
You can install |jedi| directly from official Arch Linux packages: You can install |jedi| directly from official Arch Linux packages:
- `python-jedi <https://www.archlinux.org/packages/community/any/python-jedi/>`__ - `python-jedi <https://www.archlinux.org/packages/community/any/python-jedi/>`__
(Python 3)
- `python2-jedi <https://www.archlinux.org/packages/community/any/python2-jedi/>`__
(Python 2)
The specified Python version just refers to the *runtime environment* for
|jedi|. Use the Python 2 version if you're running vim (or whatever editor you
use) under Python 2. Otherwise, use the Python 3 version. But whatever version
you choose, both are able to complete both Python 2 and 3 *code*.
(There is also a packaged version of the vim plugin available: (There is also a packaged version of the vim plugin available:
`vim-jedi at Arch Linux <https://www.archlinux.org/packages/community/any/vim-jedi/>`__.) `vim-jedi at Arch Linux <https://www.archlinux.org/packages/community/any/vim-jedi/>`__.)

View File

@@ -336,7 +336,7 @@ class BaseName(object):
>>> print(defs) # doctest: +NORMALIZE_WHITESPACE >>> print(defs) # doctest: +NORMALIZE_WHITESPACE
[<Name full_name='__main__.f', description='def f'>, [<Name full_name='__main__.f', description='def f'>,
<Name full_name='__main__.C', description='class C'>] <Name full_name='__main__.C', description='class C'>]
>>> str(defs[0].description) # strip literals in python2 >>> str(defs[0].description)
'def f' 'def f'
>>> str(defs[1].description) >>> str(defs[1].description)
'class C' 'class C'

View File

@@ -503,7 +503,7 @@ _calls = [
@pytest.mark.parametrize('ending', ['', ')']) @pytest.mark.parametrize('ending', ['', ')'])
@pytest.mark.parametrize('code, call, expected_index', _calls) @pytest.mark.parametrize('code, call, expected_index', _calls)
def test_signature_index(skip_python2, Script, environment, code, call, expected_index, ending): def test_signature_index(Script, environment, code, call, expected_index, ending):
if isinstance(expected_index, tuple): if isinstance(expected_index, tuple):
expected_index = expected_index[environment.version_info > (3, 8)] expected_index = expected_index[environment.version_info > (3, 8)]
if environment.version_info < (3, 8): if environment.version_info < (3, 8):

View File

@@ -91,7 +91,7 @@ def test_version_info(Script):
assert c.docstring() == 'sys.version_info\n\nVersion information as a named tuple.' assert c.docstring() == 'sys.version_info\n\nVersion information as a named tuple.'
def test_builtin_docstring(goto_or_help_or_infer, skip_python2): def test_builtin_docstring(goto_or_help_or_infer):
d, = goto_or_help_or_infer('open') d, = goto_or_help_or_infer('open')
doc = d.docstring() doc = d.docstring()
@@ -99,7 +99,7 @@ def test_builtin_docstring(goto_or_help_or_infer, skip_python2):
assert 'Open file' in doc assert 'Open file' in doc
def test_docstring_decorator(goto_or_help_or_infer, skip_python2): def test_docstring_decorator(goto_or_help_or_infer):
code = dedent(''' code = dedent('''
import types import types

View File

@@ -1,5 +1,3 @@
import sys
import pytest import pytest
_tuple_code = 'from typing import Tuple\ndef f(x: Tuple[int]): ...\nf' _tuple_code = 'from typing import Tuple\ndef f(x: Tuple[int]): ...\nf'
@@ -20,7 +18,7 @@ _tuple_code = 'from typing import Tuple\ndef f(x: Tuple[int]): ...\nf'
('def f(*args: int, **kwargs: str): ...\nf', ['class int', 'class str'], False), ('def f(*args: int, **kwargs: str): ...\nf', ['class int', 'class str'], False),
] ]
) )
def test_param_annotation(Script, code, expected_params, execute_annotation, skip_python2): def test_param_annotation(Script, code, expected_params, execute_annotation):
func, = Script(code).goto() func, = Script(code).goto()
sig, = func.get_signatures() sig, = func.get_signatures()
for p, expected in zip(sig.params, expected_params): for p, expected in zip(sig.params, expected_params):
@@ -60,7 +58,7 @@ def test_param_default(Script, code, expected_params):
('def f(*args, x): pass\nf', 1, 'x', 'KEYWORD_ONLY'), ('def f(*args, x): pass\nf', 1, 'x', 'KEYWORD_ONLY'),
] ]
) )
def test_param_kind_and_name(code, index, param_code, kind, Script, skip_python2): def test_param_kind_and_name(code, index, param_code, kind, Script):
func, = Script(code).goto() func, = Script(code).goto()
sig, = func.get_signatures() sig, = func.get_signatures()
param = sig.params[index] param = sig.params[index]

View File

@@ -126,7 +126,7 @@ def test_math(Script):
assert value assert value
def test_type_var(Script, skip_python2): def test_type_var(Script):
def_, = Script('import typing; T = typing.TypeVar("T1")').infer() def_, = Script('import typing; T = typing.TypeVar("T1")').infer()
assert def_.name == 'TypeVar' assert def_.name == 'TypeVar'
assert def_.description == 'class TypeVar' assert def_.description == 'class TypeVar'

View File

@@ -85,7 +85,7 @@ def test_find_module_package_zipped(Script, inference_state, environment):
) )
def test_correct_zip_package_behavior(Script, inference_state, environment, code, def test_correct_zip_package_behavior(Script, inference_state, environment, code,
file, package, path, skip_python2): file, package, path):
sys_path = environment.get_sys_path() + [pkg_zip_path] sys_path = environment.get_sys_path() + [pkg_zip_path]
pkg, = Script(code, project=Project('.', sys_path=sys_path)).infer() pkg, = Script(code, project=Project('.', sys_path=sys_path)).infer()
value, = pkg._name.infer() value, = pkg._name.infer()

View File

@@ -26,7 +26,7 @@ def test_f_strings(Script, environment):
assert _infer_literal(Script, 'rF"{asdf} "', is_fstring=True) == '' assert _infer_literal(Script, 'rF"{asdf} "', is_fstring=True) == ''
def test_rb_strings(Script, environment, skip_python2): def test_rb_strings(Script, environment):
assert _infer_literal(Script, 'x = br"asdf"; x') == b'asdf' assert _infer_literal(Script, 'x = br"asdf"; x') == b'asdf'
assert _infer_literal(Script, 'x = rb"asdf"; x') == b'asdf' assert _infer_literal(Script, 'x = rb"asdf"; x') == b'asdf'