about summary refs log tree commit diff stats
path: root/tests/pylint/test_py2_compat.py
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-01-05 18:52:25 +0100
committertoonn <toonn@toonn.io>2021-01-05 18:52:25 +0100
commit790d90853504f62e9449844a6481f3955190e35d (patch)
treebaf6c8c4eca175ab0da304c840285bfdbaa4ee09 /tests/pylint/test_py2_compat.py
parent7a0d077e4545f18d30488122fee80ba4df1c7b52 (diff)
parent6fd49695111232df31358a67b11dc5ee3b8dbcfc (diff)
downloadranger-790d90853504f62e9449844a6481f3955190e35d.tar.gz
Merge branch 'chu4ng-fix-files-index' into fix-files-none
Diffstat (limited to 'tests/pylint/test_py2_compat.py')
-rw-r--r--tests/pylint/test_py2_compat.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/pylint/test_py2_compat.py b/tests/pylint/test_py2_compat.py
index a5d2e284..bd1ace65 100644
--- a/tests/pylint/test_py2_compat.py
+++ b/tests/pylint/test_py2_compat.py
@@ -5,6 +5,9 @@ import py2_compat
 import astroid
 import pylint.testutils
 
+from sys import version_info
+PY2 = version_info[0] < 3
+
 
 class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase):
     CHECKER_CLASS = py2_compat.Py2CompatibilityChecker
@@ -42,6 +45,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase):
             self.checker.visit_classdef(from_new)
 
     def test_print_without_import(self):
+        if PY2:
+            return
+
         print_function_call = astroid.extract_node("""
         print("Print function call without importing print_function")
         """)
@@ -73,6 +79,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase):
             self.checker.visit_call(nested_print_function_call)
 
     def test_print_late_import(self):
+        if PY2:
+            return
+
         early_print_function_call = astroid.extract_node("""
         print("Nested print with import in scope") #@
         def f():
@@ -91,6 +100,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase):
             self.checker.visit_call(early_print_function_call)
 
     def test_implicit_format_spec(self):
+        if PY2:
+            return
+
         implicit_format_spec = astroid.extract_node("""
         "{}".format("implicit") #@
         """)