aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2020-11-11 21:10:57 +0100
committertoonn <toonn@toonn.io>2020-11-11 21:10:57 +0100
commit6572e37c5f9526ad0f2a41c2f654a3cdf31db112 (patch)
tree09ef7e9521ba27dd7db6719561462fd340b86686
parentd323678ec06693ed15319f7dc883c9da96722965 (diff)
downloadranger-6572e37c5f9526ad0f2a41c2f654a3cdf31db112.tar.gz
Shortcut py2 incompatible pytest tests
Three of our pytest tests aren't compatible with python 2 by returning early from these testcases and always making them pass, we avoid false negatives in CI results.
-rw-r--r--tests/pylint/test_py2_compat.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/pylint/test_py2_compat.py b/tests/pylint/test_py2_compat.py
index a5d2e284..08c8de31 100644
--- a/tests/pylint/test_py2_compat.py
+++ b/tests/pylint/test_py2_compat.py
@@ -5,6 +5,8 @@ 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 +44,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 +78,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 +99,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") #@
""")