summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-03-11 14:21:28 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2020-03-11 14:21:28 +0100
commit87681f72477d7bc19e2443203f0e88c10d1ef804 (patch)
treee208b31e7d1944db08a1298eb78362f45f4a18c6
parent762e1a13601f5e205a6be1c8b5450f2c519b87de (diff)
downloadpylint-git-87681f72477d7bc19e2443203f0e88c10d1ef804.tar.gz
Add exclude_platforms to functional tests and use it for non_ascii_name check
-rw-r--r--pylint/checkers/base.py2
-rw-r--r--pylint/testutils.py8
-rw-r--r--tests/functional/n/non_ascii_name.rc3
-rw-r--r--tests/test_functional.py4
4 files changed, 12 insertions, 5 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py
index 9b0ead80d..b7cb6e245 100644
--- a/pylint/checkers/base.py
+++ b/pylint/checkers/base.py
@@ -1719,7 +1719,7 @@ class NameChecker(_BasicChecker):
"C0144": (
'%s name "%s" contains a non-ASCII unicode character',
"non-ascii-name",
- "Used when the name contains at least one non-ASCII unciode character.",
+ "Used when the name contains at least one non-ASCII unicode character.",
),
"W0111": (
"Name %s will become a keyword in Python %s",
diff --git a/pylint/testutils.py b/pylint/testutils.py
index 704ca4286..9b1d98ed5 100644
--- a/pylint/testutils.py
+++ b/pylint/testutils.py
@@ -384,6 +384,7 @@ class FunctionalTestFile:
"max_pyver": (4, 0),
"requires": [],
"except_implementations": [],
+ "exclude_platforms": [],
}
self._parse_options()
@@ -530,6 +531,13 @@ class LintModuleTest:
pytest.skip(
"Test cannot run with Python implementation %r" % (implementation,)
)
+ if self._test_file.options["exclude_platforms"]:
+ platforms = [
+ item.strip()
+ for item in self._test_file.options["exclude_platforms"].split(",")
+ ]
+ if sys.platform.lower() in platforms:
+ pytest.skip("Test cannot run on platform %r" % (sys.platform,))
def _should_be_skipped_due_to_version(self):
return (
diff --git a/tests/functional/n/non_ascii_name.rc b/tests/functional/n/non_ascii_name.rc
new file mode 100644
index 000000000..ff09ea1f6
--- /dev/null
+++ b/tests/functional/n/non_ascii_name.rc
@@ -0,0 +1,3 @@
+[testoptions]
+# This test cannot run on Windows due to Unicode error formatting.
+exclude_platforms=win32
diff --git a/tests/test_functional.py b/tests/test_functional.py
index 933c85a83..184934e8b 100644
--- a/tests/test_functional.py
+++ b/tests/test_functional.py
@@ -16,7 +16,6 @@
import csv
import io
import os
-import platform
import sys
import pytest
@@ -70,9 +69,6 @@ def get_tests():
if dirpath.endswith("__pycache__"):
continue
for filename in filenames:
- if filename == "non_ascii_name.py" and os.name == "nt":
- # skip this test on Windows since it involves Unicode
- continue
if filename != "__init__.py" and filename.endswith(".py"):
suite.append(testutils.FunctionalTestFile(dirpath, filename))
return suite