summaryrefslogtreecommitdiff
path: root/tests/testutils/test_functional_testutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testutils/test_functional_testutils.py')
-rw-r--r--tests/testutils/test_functional_testutils.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/tests/testutils/test_functional_testutils.py b/tests/testutils/test_functional_testutils.py
index 68dad697d..d1047c8ee 100644
--- a/tests/testutils/test_functional_testutils.py
+++ b/tests/testutils/test_functional_testutils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Tests for the functional test framework."""
@@ -41,8 +41,32 @@ def test_parsing_of_pylintrc_init_hook() -> None:
def test_get_functional_test_files_from_directory() -> None:
"""Test that we correctly check the functional test directory structures."""
- with pytest.raises(AssertionError, match="using_dir.py should not go in"):
- get_functional_test_files_from_directory(DATA_DIRECTORY)
+ with pytest.raises(AssertionError) as exc_info:
+ get_functional_test_files_from_directory(DATA_DIRECTORY / "u")
+ assert exc_info.match("'use_dir.py' should go in 'use'")
+ assert exc_info.match(
+ "using_dir.py should go in a directory that starts with the "
+ "first letters of 'using_dir'"
+ )
+ assert "incredibly_bold_mischief.py" not in str(exc_info.value)
+ # Leading underscore mean that this should not fail the assertion
+ get_functional_test_files_from_directory(DATA_DIRECTORY / "u/_no_issue_here")
+
+
+def test_get_functional_test_files_from_crowded_directory() -> None:
+ """Test that we correctly check the functional test directory structures."""
+ with pytest.raises(AssertionError) as exc_info:
+ get_functional_test_files_from_directory(
+ DATA_DIRECTORY / "m", max_file_per_directory=1
+ )
+ assert exc_info.match("m: 4 when the max is 1")
+ assert exc_info.match("max_overflow: 3 when the max is 1")
+ with pytest.raises(AssertionError) as exc_info:
+ get_functional_test_files_from_directory(
+ DATA_DIRECTORY / "m", max_file_per_directory=3
+ )
+ assert exc_info.match("m: 4 when the max is 3")
+ assert "max_overflow" not in str(exc_info.value)
def test_minimal_messages_config_enabled(pytest_config: MagicMock) -> None: