Skip pep0484 tests when using Python 2.6.

This commit is contained in:
Dave Halter
2016-01-26 15:59:27 -02:00
parent 633e5aa76f
commit 257009d238
2 changed files with 9 additions and 6 deletions

View File

@@ -3,6 +3,8 @@ Test the typing library, with docstrings. This is needed since annotations
are not supported in python 2.7 else then annotating by comment (and this is are not supported in python 2.7 else then annotating by comment (and this is
still TODO at 2016-01-23) still TODO at 2016-01-23)
""" """
# There's no Python 2.6 typing module.
# python >= 2.7
import typing import typing
class B: class B:
pass pass

View File

@@ -249,14 +249,16 @@ def skip_python_version(line):
map(int, match.group(2).split("."))) map(int, match.group(2).split(".")))
operation = getattr(operator, comp_map[match.group(1)]) operation = getattr(operator, comp_map[match.group(1)])
if not operation(sys.version_info, minimal_python_version): if not operation(sys.version_info, minimal_python_version):
return "Minimal python version %s" % match.group(1) return "Minimal python version %s %s" % (match.group(1), match.group(2))
return None return None
def collect_file_tests(lines, lines_to_execute): def collect_file_tests(path, lines, lines_to_execute):
makecase = lambda t: IntegrationTestCase(t, correct, line_nr, column, def makecase(t):
start, line, path=None, skip=skip) return IntegrationTestCase(t, correct, line_nr, column,
start, line, path=path, skip=skip)
start = None start = None
correct = None correct = None
test_type = None test_type = None
@@ -325,9 +327,8 @@ def collect_dir_tests(base_dir, test_files, check_thirdparty=False):
else: else:
source = unicode(open(path).read(), 'UTF-8') source = unicode(open(path).read(), 'UTF-8')
for case in collect_file_tests(StringIO(source), for case in collect_file_tests(path, StringIO(source),
lines_to_execute): lines_to_execute):
case.path = path
case.source = source case.source = source
if skip: if skip:
case.skip = skip case.skip = skip