1
0
forked from VimPlug/jedi

Remove a lot of sys.version_info references

This commit is contained in:
Dave Halter
2020-07-02 02:45:35 +02:00
parent cfd8eb23b8
commit f4e537fd72
18 changed files with 22 additions and 98 deletions

View File

@@ -1,10 +1,4 @@
import sys
import pytest
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_issue436(Script, skip_python2):
def test_issue436(Script):
code = "bar = 0\nbar += 'foo' + 4"
errors = set(repr(e) for e in Script(code)._analysis())
assert len(errors) == 2

View File

@@ -3,7 +3,6 @@ Test all things related to the ``jedi.api`` module.
"""
import os
import sys
from textwrap import dedent
import pytest
@@ -16,7 +15,6 @@ from jedi.inference.gradual import typeshed
from test.helpers import test_dir, get_example_dir
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, EoL")
def test_preload_modules():
def check_loaded(*modules):
for grammar_cache in cache.parser_cache.values():
@@ -119,8 +117,8 @@ def test_completion_on_complex_literals(Script):
# However this has been disabled again, because it apparently annoyed
# users. So no completion after j without a space :)
assert not Script('4j').complete()
assert ({c.name for c in Script('4j ').complete()} ==
{'if', 'and', 'in', 'is', 'not', 'or'})
assert ({c.name for c in Script('4j ').complete()}
== {'if', 'and', 'in', 'is', 'not', 'or'})
def test_goto_non_name(Script, environment):

View File

@@ -1,4 +1,3 @@
import sys
from textwrap import dedent
import inspect
from unittest import TestCase
@@ -515,7 +514,6 @@ def test_signature_index(skip_python2, Script, environment, code, call, expected
assert expected_index == index
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Python 2 doesn't support __signature__")
@pytest.mark.parametrize('code', ['foo', 'instance.foo'])
def test_arg_defaults(Script, environment, code):
def foo(arg="bla", arg1=1):

View File

@@ -1,6 +1,5 @@
from os.path import join, sep as s, dirname, expanduser
import os
import sys
from textwrap import dedent
import pytest
@@ -75,10 +74,7 @@ def test_loading_unicode_files_with_bad_global_charset(Script, monkeypatch, tmpd
dirname = str(tmpdir.mkdir('jedi-test'))
filename1 = join(dirname, 'test1.py')
filename2 = join(dirname, 'test2.py')
if sys.version_info < (3, 0):
data = "# coding: latin-1\nfoo = 'm\xf6p'\n"
else:
data = "# coding: latin-1\nfoo = 'm\xf6p'\n".encode("latin-1")
data = "# coding: latin-1\nfoo = 'm\xf6p'\n".encode("latin-1")
with open(filename1, "wb") as f:
f.write(data)
@@ -372,7 +368,6 @@ _dict_keys_completion_tests = [
]
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize(
'added_code, column, expected', _dict_keys_completion_tests
)
@@ -398,7 +393,6 @@ def test_dict_keys_completions(Script, added_code, column, expected):
assert [c.complete for c in comps] == expected
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_dict_keys_in_weird_case(Script):
assert Script('a[\n# foo\nx]').complete(line=2, column=0)

View File

@@ -117,7 +117,6 @@ def test_create_environment_executable():
assert environment.executable == sys.executable
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_get_default_environment_from_env_does_not_use_safe(tmpdir, monkeypatch):
fake_python = os.path.join(str(tmpdir), 'fake_python')
with open(fake_python, 'w', newline='') as f:

View File

@@ -184,7 +184,6 @@ def test_property_warnings(stacklevel, allow_unsafe_getattr):
_assert_interpreter_complete('foo.prop.uppe', locals(), expected)
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize('class_is_findable', [False, True])
def test__getattr__completions(allow_unsafe_getattr, class_is_findable):
class CompleteGetattr(object):
@@ -275,7 +274,6 @@ def test_property_content():
assert def_.name == 'int'
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_param_completion():
def foo(bar):
pass
@@ -326,7 +324,6 @@ def test_completion_param_annotations():
assert d.name == 'bytes'
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_keyword_argument():
def f(some_keyword_argument):
pass
@@ -433,7 +430,6 @@ def test_sys_path_docstring(): # Was an issue in #1298
s.complete(line=2, column=4)[0].docstring()
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize(
'code, completions', [
('x[0].uppe', ['upper']),
@@ -479,7 +475,6 @@ def test_simple_completions(code, completions):
assert [d.name for d in defs] == completions
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Python 2 doesn't have lru_cache")
def test__wrapped__():
from functools import lru_cache
@@ -492,7 +487,6 @@ def test__wrapped__():
assert c.line == syslogs_to_df.__wrapped__.__code__.co_firstlineno + 1
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_illegal_class_instance():
class X:
__class__ = 1
@@ -502,14 +496,12 @@ def test_illegal_class_instance():
assert not v.is_instance()
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize('module_name', ['sys', 'time', 'unittest.mock'])
def test_core_module_completes(module_name):
module = import_module(module_name)
assert jedi.Interpreter('module.', [locals()]).complete()
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize(
'code, expected, index', [
('a(', ['a', 'b', 'c'], 0),
@@ -535,7 +527,6 @@ def test_partial_signatures(code, expected, index):
assert index == sig.index
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_type_var():
"""This was an issue before, see Github #1369"""
import typing
@@ -544,7 +535,6 @@ def test_type_var():
assert def_.name == 'TypeVar'
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize('class_is_findable', [False, True])
def test_param_annotation_completion(class_is_findable):
class Foo:
@@ -558,7 +548,6 @@ def test_param_annotation_completion(class_is_findable):
assert def_.name == 'bar'
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize(
'code, column, expected', [
('strs[', 5, ["'asdf'", "'fbar'", "'foo'", Ellipsis]),
@@ -589,7 +578,6 @@ def test_dict_completion(code, column, expected):
assert [c.complete for c in comps] == expected
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize(
'code, types', [
('dct[1]', ['int']),

View File

@@ -1,5 +1,4 @@
import os
import sys
import pytest
@@ -133,7 +132,6 @@ def test_load_save_project(tmpdir):
('multiprocessin', ['multiprocessing'], dict(complete=True)),
]
)
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Ignore Python 2, because EOL")
def test_search(string, full_names, kwargs):
some_search_test_var = 1.0
project = Project(test_dir)
@@ -152,7 +150,6 @@ def test_search(string, full_names, kwargs):
('test_load_save_p', ['roject'], False),
]
)
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Ignore Python 2, because EOL")
def test_complete_search(Script, string, completions, all_scopes):
project = Project(test_dir)
defs = project.complete_search(string, all_scopes=all_scopes)

View File

@@ -66,9 +66,6 @@ class SomeClass:
]
)
def test_simple_search(Script, string, descriptions, kwargs):
if sys.version_info < (3, 6):
pytest.skip()
if kwargs.pop('complete', False) is True:
defs = Script(path=__file__).complete_search(string, **kwargs)
else: