diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-08 22:02:24 +0000 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-08 22:02:24 +0000 |
commit | b18e5fc4c290642e95a2ea296c1b843facf47067 (patch) | |
tree | 5c80fc27af61171e1890b8daa81f00734a7c3c01 /tests | |
parent | eb9b263589f78e245c8b374467707ce2abe570d2 (diff) | |
parent | 650ed1c8bd461e0ab30108a755a753c9fd46e7bf (diff) | |
download | gobject-introspection-b18e5fc4c290642e95a2ea296c1b843facf47067.tar.gz |
Merge branch 'drop-py-compat-code' into 'master'
Drop all Python 2 compat code
See merge request GNOME/gobject-introspection!85
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/offsets/gen-gitestoffsets | 2 | ||||
-rw-r--r-- | tests/scanner/annotationparser/test_parser.py | 15 | ||||
-rw-r--r-- | tests/scanner/annotationparser/test_patterns.py | 15 | ||||
-rw-r--r-- | tests/scanner/test_pkgconfig.py | 9 | ||||
-rw-r--r-- | tests/scanner/test_shlibs.py | 5 | ||||
-rw-r--r-- | tests/scanner/test_sourcescanner.py | 5 | ||||
-rw-r--r-- | tests/scanner/test_transformer.py | 5 | ||||
-rw-r--r-- | tests/warn/warningtester.py | 11 |
8 files changed, 6 insertions, 61 deletions
diff --git a/tests/offsets/gen-gitestoffsets b/tests/offsets/gen-gitestoffsets index 94a2062d..2e9bc5fb 100755 --- a/tests/offsets/gen-gitestoffsets +++ b/tests/offsets/gen-gitestoffsets @@ -19,8 +19,6 @@ # 02110-1301, USA. # -from __future__ import print_function - # The idea here is that we want to compare offset information two ways: # # 1) As generated by the compiler diff --git a/tests/scanner/annotationparser/test_parser.py b/tests/scanner/annotationparser/test_parser.py index b676a508..368eb728 100644 --- a/tests/scanner/annotationparser/test_parser.py +++ b/tests/scanner/annotationparser/test_parser.py @@ -25,14 +25,8 @@ test_parser.py Tests ensuring annotationparser.py continues to function correctly. ''' -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import difflib import os -import sys import subprocess import unittest import xml.etree.ElementTree as etree @@ -41,11 +35,6 @@ from giscanner.annotationparser import GtkDocCommentBlockParser, GtkDocCommentBl from giscanner.ast import Namespace from giscanner.message import MessageLogger, WARNING, ERROR, FATAL -if sys.version_info.major < 3: - encode_name = lambda s: s.encode('ascii') -else: - encode_name = lambda s: s - XML_NS = 'http://schemas.gnome.org/gobject-introspection/2013/test' XML_SCHEMA = os.path.abspath(os.path.join(os.path.dirname(__file__), 'tests.xsd')) @@ -406,7 +395,7 @@ def create_test_case(logger, tests_dir, tests_file): for counter, test in enumerate(tests_tree.findall(ns('{}test'))): test_name = 'test_%03d' % (counter + 1) test_method = TestCommentBlock.__create_test__(logger, test) - test_method.__name__ = encode_name(test_name) + test_method.__name__ = test_name test_methods[test_name] = test_method # Dynamically generate a new subclass of TestCommentBlock in TitleCase @@ -414,7 +403,7 @@ def create_test_case(logger, tests_dir, tests_file): test_class_name = os.path.relpath(tests_file[:-4], tests_dir) test_class_name = test_class_name.replace('/', ' ').replace('\\', ' ').replace('.', ' ') test_class_name = 'Test' + test_class_name.title().replace(' ', '') - return type(encode_name(test_class_name), (TestCommentBlock,), test_methods) + return type(test_class_name, (TestCommentBlock,), test_methods) def create_test_cases(): diff --git a/tests/scanner/annotationparser/test_patterns.py b/tests/scanner/annotationparser/test_patterns.py index 0a0e3175..131d6282 100644 --- a/tests/scanner/annotationparser/test_patterns.py +++ b/tests/scanner/annotationparser/test_patterns.py @@ -29,12 +29,6 @@ should match, resulting symbolic groups are verified against the expected output. ''' -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - -import sys import unittest from giscanner.annotationparser import (COMMENT_BLOCK_START_RE, COMMENT_BLOCK_END_RE, @@ -43,11 +37,6 @@ from giscanner.annotationparser import (COMMENT_BLOCK_START_RE, COMMENT_BLOCK_EN SIGNAL_RE, PARAMETER_RE, TAG_RE, TAG_VALUE_VERSION_RE, TAG_VALUE_STABILITY_RE) -if sys.version_info.major < 3: - encode_name = lambda s: s.encode('ascii') -else: - encode_name = lambda s: s - comment_start_tests = [ (COMMENT_BLOCK_START_RE, '/**', @@ -902,10 +891,10 @@ def create_test_case(tests_class_name, testcases): for counter, test in enumerate(testcases): test_name = 'test_%03d' % (counter + 1) test_method = create_test_method(test) - test_method.__name__ = encode_name(test_name) + test_method.__name__ = test_name test_methods[test_name] = test_method - return type(encode_name(tests_class_name), (unittest.TestCase,), test_methods) + return type(tests_class_name, (unittest.TestCase,), test_methods) def create_test_cases(): diff --git a/tests/scanner/test_pkgconfig.py b/tests/scanner/test_pkgconfig.py index e81dedb6..8b654e38 100644 --- a/tests/scanner/test_pkgconfig.py +++ b/tests/scanner/test_pkgconfig.py @@ -18,11 +18,6 @@ # Boston, MA 02111-1307, USA. # -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import contextlib import os import sys @@ -88,9 +83,7 @@ class PkgConfigTest(unittest.TestCase): with pkg_config_script(s) as command: pkgconfig.libs(['a', 'b-42.0'], command=command) - @unittest.skipIf( - sys.version_info < (3, 0) or os.name == "nt", - "Python 2 defaults to ascii encoding in text file I/O and nothing is done to change that") + @unittest.skipIf(os.name == "nt", "FIXME") def test_non_ascii_output(self): with pkg_config_script("""print("-L'zażółć gęślą jaźń'")""") as command: flags = pkgconfig.cflags(['test-1.0'], command=command) diff --git a/tests/scanner/test_shlibs.py b/tests/scanner/test_shlibs.py index c3e28892..f3fb0d2e 100644 --- a/tests/scanner/test_shlibs.py +++ b/tests/scanner/test_shlibs.py @@ -1,8 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import unittest from giscanner.shlibs import resolve_from_ldd_output diff --git a/tests/scanner/test_sourcescanner.py b/tests/scanner/test_sourcescanner.py index 624d9df9..ecd312e3 100644 --- a/tests/scanner/test_sourcescanner.py +++ b/tests/scanner/test_sourcescanner.py @@ -1,8 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import unittest import tempfile import os diff --git a/tests/scanner/test_transformer.py b/tests/scanner/test_transformer.py index c0fb2d6f..27bfad58 100644 --- a/tests/scanner/test_transformer.py +++ b/tests/scanner/test_transformer.py @@ -1,8 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import unittest import tempfile import os diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index be5aec13..8f441879 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -1,16 +1,7 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import os import sys import difflib - -if sys.version_info.major < 3: - import __builtin__ as builtins -else: - import builtins +import builtins path = os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None) assert path is not None |