summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2020-11-14 15:43:57 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2020-11-28 16:09:53 +0100
commite98d371f6f54c5086710792ef4858db57bf1e1d9 (patch)
treeda48fe51bb2183405d81231bdc120bbf15a4fe8c
parent98ed9b42936296e2334020d4d4b6a680f539eca0 (diff)
downloadpylint-git-e98d371f6f54c5086710792ef4858db57bf1e1d9.tar.gz
Silence an expected deprecation warning in a test_func.py test
-rw-r--r--tests/test_func.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_func.py b/tests/test_func.py
index 4b71d3e35..f38b03f6a 100644
--- a/tests/test_func.py
+++ b/tests/test_func.py
@@ -31,6 +31,7 @@ SYS_VERS_STR = "%d%d%d" % sys.version_info[:3]
INPUT_DIR = join(dirname(abspath(__file__)), "input")
MSG_DIR = join(dirname(abspath(__file__)), "messages")
+
FILTER_RGX = None
UPDATE = False
INFO_TEST_RGX = re.compile(r"^func_i\d\d\d\d$")
@@ -120,20 +121,29 @@ def gen_tests(filter_rgx):
base = module_file.replace(".py", "").split("_")[1]
dependencies = _get_tests_info(INPUT_DIR, MSG_DIR, base, ".py")
tests.append((module_file, messages_file, dependencies))
-
if UPDATE:
return tests
-
assert len(tests) < 196, "Please do not add new test cases here."
return tests
+TEST_WITH_EXPECTED_DEPRECATION = ["func_excess_escapes.py"]
+
+
@pytest.mark.parametrize(
"module_file,messages_file,dependencies",
gen_tests(FILTER_RGX),
ids=[o[0] for o in gen_tests(FILTER_RGX)],
)
def test_functionality(module_file, messages_file, dependencies):
+ if module_file in TEST_WITH_EXPECTED_DEPRECATION:
+ # Remove <unknown>:x: DeprecationWarning: invalid escape sequence
+ with pytest.deprecated_call():
+ __test_functionality(module_file, messages_file, dependencies)
+ __test_functionality(module_file, messages_file, dependencies)
+
+
+def __test_functionality(module_file, messages_file, dependencies):
lint_test = LintTestUpdate() if UPDATE else LintTestUsingModule()
lint_test.module = module_file.replace(".py", "")
lint_test.output = messages_file