summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-01 08:56:25 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-03 22:49:21 +0200
commit63ca05977dc11efe4c51f64a08c02fd0fb0566fc (patch)
tree192c6555626d84b39d34d37c23e24baa7c846eb5 /tests
parent8b3b8e27c891c4678b2e239c899fb4e12714ab67 (diff)
downloadpylint-git-63ca05977dc11efe4c51f64a08c02fd0fb0566fc.tar.gz
Move utils.expand_module in its own file in lint
We never used it anywhere else than lint so it belong in lint.
Diffstat (limited to 'tests')
-rw-r--r--tests/lint/unittest_expand_modules.py19
-rw-r--r--tests/utils/unittest_utils.py13
2 files changed, 19 insertions, 13 deletions
diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py
new file mode 100644
index 000000000..2a6b072ff
--- /dev/null
+++ b/tests/lint/unittest_expand_modules.py
@@ -0,0 +1,19 @@
+# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
+
+
+import re
+
+from pylint.lint.expand_modules import _basename_in_ignore_list_re
+
+
+def test__basename_in_ignore_list_re_match():
+ patterns = [re.compile(".*enchilada.*"), re.compile("unittest_.*")]
+ assert _basename_in_ignore_list_re("unittest_utils.py", patterns)
+ assert _basename_in_ignore_list_re("cheese_enchiladas.xml", patterns)
+
+
+def test__basename_in_ignore_list_re_nomatch():
+ patterns = [re.compile(".*enchilada.*"), re.compile("unittest_.*")]
+ assert not _basename_in_ignore_list_re("test_utils.py", patterns)
+ assert not _basename_in_ignore_list_re("enchilad.py", patterns)
diff --git a/tests/utils/unittest_utils.py b/tests/utils/unittest_utils.py
index ff851c31c..ae53a6129 100644
--- a/tests/utils/unittest_utils.py
+++ b/tests/utils/unittest_utils.py
@@ -18,23 +18,10 @@
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
import io
-import re
from pylint.utils import utils
-def test__basename_in_ignore_list_re_match():
- patterns = [re.compile(".*enchilada.*"), re.compile("unittest_.*")]
- assert utils._basename_in_ignore_list_re("unittest_utils.py", patterns)
- assert utils._basename_in_ignore_list_re("cheese_enchiladas.xml", patterns)
-
-
-def test__basename_in_ignore_list_re_nomatch():
- patterns = [re.compile(".*enchilada.*"), re.compile("unittest_.*")]
- assert not utils._basename_in_ignore_list_re("test_utils.py", patterns)
- assert not utils._basename_in_ignore_list_re("enchilad.py", patterns)
-
-
def test_decoding_stream_unknown_encoding():
"""decoding_stream should fall back to *some* decoding when given an
unknown encoding.