diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 9cce90a5..c57c2a10 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -118,12 +118,6 @@ Usage:: """ -# StringIO (Python 2.5 has no io module), so use io only for py3k -try: - from StringIO import StringIO -except ImportError: - from io import StringIO - # hasattr function used because python if is_py3: hasattr = hasattr diff --git a/jedi/parser/tokenize.py b/jedi/parser/tokenize.py index 40c63123..7c155498 100644 --- a/jedi/parser/tokenize.py +++ b/jedi/parser/tokenize.py @@ -11,7 +11,7 @@ from __future__ import absolute_import import string import re -from jedi._compatibility import StringIO +from io import StringIO from token import * import collections cookie_re = re.compile("coding[:=]\s*([-\w.]+)") diff --git a/test/run.py b/test/run.py index 6e519b79..4a225532 100755 --- a/test/run.py +++ b/test/run.py @@ -99,10 +99,11 @@ Tests look like this:: import os import re from ast import literal_eval +from io import StringIO +from functools import reduce import jedi -from functools import reduce -from jedi._compatibility import unicode, StringIO, is_py3 +from jedi._compatibility import unicode, is_py3 TEST_COMPLETIONS = 0 @@ -215,10 +216,7 @@ def collect_file_tests(lines, lines_to_execute): start = None correct = None test_type = None - for line_nr, line in enumerate(lines): - line_nr += 1 # py2.5 doesn't know about the additional enumerate param - if not is_py3: - line = unicode(line, 'UTF-8') + for line_nr, line in enumerate(lines, 1): if correct: r = re.match('^(\d+)\s*(.*)$', correct) if r: @@ -268,6 +266,8 @@ def collect_dir_tests(base_dir, test_files, check_thirdparty=False): path = os.path.join(base_dir, f_name) source = open(path).read() + if not is_py3: + source = unicode(source, 'UTF-8') for case in collect_file_tests(StringIO(source), lines_to_execute): case.path = path @@ -373,8 +373,4 @@ if __name__ == '__main__': print(s) exit_code = 1 if tests_fail else 0 - if sys.hexversion < 0x02060000 and tests_fail <= 9: - # Python 2.5 has major incompabillities (e.g. no property.setter), - # therefore it is not possible to pass all tests. - exit_code = 0 sys.exit(exit_code)