Remove py__version__

This commit is contained in:
Dave Halter
2020-07-02 02:28:47 +02:00
parent 0cd6a8f5cc
commit db28eee760
6 changed files with 8 additions and 26 deletions

View File

@@ -1,13 +1,13 @@
import tempfile
import shutil
import os
import sys
from functools import partial
import pytest
import jedi
from jedi.api.environment import get_system_environment, InterpreterEnvironment
from jedi._compatibility import py_version
from test.helpers import test_dir
collect_ignore = [
@@ -93,7 +93,8 @@ def clean_jedi_cache(request):
def environment(request):
version = request.config.option.env
if version is None:
version = os.environ.get('JEDI_TEST_ENVIRONMENT', str(py_version))
v = str(sys.version_info[0]) + str(sys.version_info[1])
version = os.environ.get('JEDI_TEST_ENVIRONMENT', v)
if request.config.option.interpreter_env or version == 'interpreter':
return InterpreterEnvironment()

View File

@@ -18,8 +18,6 @@ from zipimport import zipimporter
from jedi.file_io import KnownContentFileIO, ZipFileIO
py_version = int(str(sys.version_info[0]) + str(sys.version_info[1]))
def find_module(string, path=None, full_name=None, is_global_search=True):
"""

View File

@@ -8,7 +8,7 @@ import warnings
import re
import builtins
from jedi._compatibility import unicode, py_version
from jedi._compatibility import unicode
from jedi.inference.compiled.getattr_static import getattr_static
ALLOWED_GETITEM_TYPES = (str, list, tuple, unicode, bytes, bytearray, dict)
@@ -470,8 +470,6 @@ class DirectObjectAccess(object):
return inspect.isclass(self._obj) and self._obj != type
def _annotation_to_str(self, annotation):
if py_version < 30:
return ''
return inspect.formatannotation(annotation)
def get_signature_params(self):

View File

@@ -7,7 +7,6 @@ information returned to enable Jedi to make decisions.
import types
from jedi import debug
from jedi._compatibility import py_version
_sentinel = object()
@@ -65,7 +64,7 @@ def _static_getmro_newstyle(klass):
return mro
if py_version >= 30:
if True:
_shadowed_dict = _shadowed_dict_newstyle
_get_type = type
_static_getmro = _static_getmro_newstyle

View File

@@ -4,7 +4,6 @@ import sys
import pytest
import jedi
from jedi._compatibility import py_version
from jedi.api.environment import get_default_environment, find_virtualenvs, \
InvalidPythonEnvironment, find_system_environments, \
get_system_environment, create_environment, InterpreterEnvironment, \
@@ -33,7 +32,7 @@ def test_versions(version):
try:
env = get_system_environment(version)
except InvalidPythonEnvironment:
if int(version.replace('.', '')) == py_version:
if int(version.replace('.', '')) == str(sys.version_info[0]) + str(sys.version_info[1]):
# At least the current version has to work
raise
pytest.skip()

View File

@@ -3,26 +3,14 @@ Tests of ``jedi.api.Interpreter``.
"""
import sys
import warnings
import typing
import pytest
import jedi
from jedi._compatibility import py_version
from jedi.inference.compiled import mixed
from importlib import import_module
if py_version > 30:
def exec_(source, global_map):
exec(source, global_map)
else:
eval(compile("""def exec_(source, global_map):
exec source in global_map """, 'blub', 'exec'))
if py_version > 35:
import typing
else:
typing = None
class _GlobalNameSpace:
class SideEffectContainer:
@@ -321,7 +309,7 @@ def test_completion_param_annotations():
# Need to define this function not directly in Python. Otherwise Jedi is too
# clever and uses the Python code instead of the signature object.
code = 'def foo(a: 1, b: str, c: int = 1.0) -> bytes: pass'
exec_(code, locals())
exec(code, locals())
script = jedi.Interpreter('foo', [locals()])
c, = script.complete()
sig, = c.get_signatures()
@@ -625,7 +613,6 @@ def bar():
return float
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize(
'annotations, result, code', [
({}, [], ''),