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,6 +1,5 @@
from textwrap import dedent
import math
import sys
from collections import Counter
from datetime import datetime
@@ -146,7 +145,6 @@ def test_parent_context(same_process_inference_state, attribute, expected_name,
assert x.parent_context.parent_context is None
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
@pytest.mark.parametrize(
'obj, expected_names', [
('', ['str']),

View File

@@ -3,7 +3,6 @@ Testing of docstring related issues and especially ``jedi.docstrings``.
"""
import os
import sys
from textwrap import dedent
import pytest
@@ -25,11 +24,6 @@ except ImportError:
else:
numpy_unavailable = False
if sys.version_info.major == 2:
# In Python 2 there's an issue with tox/docutils that makes the tests fail,
# Python 2 is soon end-of-life, so just don't support numpydoc for it anymore.
numpydoc_unavailable = True
def test_function_doc(Script):
defs = Script("""

View File

@@ -19,8 +19,7 @@ from ..helpers import get_example_dir, test_dir, test_dir_project, root_dir
THIS_DIR = os.path.dirname(__file__)
@pytest.mark.skipif('sys.version_info < (3,3)')
def test_find_module_py33():
def test_find_module_basic():
"""Needs to work like the old find_module."""
assert find_module_py33('_io') == (None, False)
with pytest.raises(ImportError):

View File

@@ -1,5 +1,4 @@
from typing import Generic, TypeVar, List
import sys
import pytest
@@ -86,7 +85,6 @@ def test_mixed_module_cache():
assert isinstance(jedi_module, ModuleValue)
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, EoL")
def test_signature():
"""
For performance reasons we use the signature of the compiled object and not

View File

@@ -39,16 +39,14 @@ def pyc_project_path(tmpdir):
compileall.compile_file(dummy_path)
os.remove(dummy_path)
if sys.version_info.major == 3:
# Python3 specific:
# To import pyc modules, we must move them out of the __pycache__
# directory and rename them to remove ".cpython-%s%d"
# see: http://stackoverflow.com/questions/11648440/python-does-not-detect-pyc-files
pycache = os.path.join(dummy_package_path, "__pycache__")
for f in os.listdir(pycache):
dst = f.replace('.cpython-%s%s' % sys.version_info[:2], "")
dst = os.path.join(dummy_package_path, dst)
shutil.copy(os.path.join(pycache, f), dst)
# To import pyc modules, we must move them out of the __pycache__
# directory and rename them to remove ".cpython-%s%d"
# see: http://stackoverflow.com/questions/11648440/python-does-not-detect-pyc-files
pycache = os.path.join(dummy_package_path, "__pycache__")
for f in os.listdir(pycache):
dst = f.replace('.cpython-%s%s' % sys.version_info[:2], "")
dst = os.path.join(dummy_package_path, dst)
shutil.copy(os.path.join(pycache, f), dst)
try:
yield path
finally:
@@ -56,7 +54,6 @@ def pyc_project_path(tmpdir):
@pytest.mark.parametrize('load_unsafe_extensions', [False, True])
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
def test_pyc(pyc_project_path, environment, load_unsafe_extensions):
"""
The list of completion must be greater than 2.