-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[functional tests] Only count python files for the reasonably displayable limit #10490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Pierre-Sassoulas
merged 5 commits into
main
from
less-constraint-on-functional-tests-structure
Aug 15, 2025
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
52f5ef9
[functional tests] Only count the number of python file for the reaso…
Pierre-Sassoulas d355547
Merge remote-tracking branch 'upstream/main' into pr/Pierre-Sassoulas…
cdce8p 56392fe
Move used_before_assignment test
cdce8p ae1e433
Fix tests
cdce8p 15a3527
Update find_functional_tests.py
cdce8p File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,17 +11,19 @@ | |
from pylint.testutils.functional.test_file import FunctionalTestFile | ||
|
||
REASONABLY_DISPLAYABLE_VERTICALLY = 49 | ||
"""'Wet finger' number of files that are reasonable to display by an IDE. | ||
"""'Wet finger' number of python files that are reasonable to have in a functional test | ||
directory. | ||
|
||
'Wet finger' as in 'in my settings there are precisely this many'. | ||
Initially the total number of files then we started counting only the python files to | ||
avoid moving a lot of files. | ||
""" | ||
|
||
IGNORED_PARENT_DIRS = { | ||
"deprecated_relative_import", | ||
"ext", | ||
"regression", | ||
"regression_02", | ||
"used_02", | ||
} | ||
"""Direct parent directories that should be ignored.""" | ||
|
||
|
@@ -71,7 +73,9 @@ def _get_files_from_dir( | |
) -> list[Path]: | ||
"""Return directories and files from a directory and handles violations.""" | ||
files_without_leading_underscore = list( | ||
p for p in path.iterdir() if not p.stem.startswith("_") | ||
p | ||
for p in path.iterdir() | ||
if not (p.stem.startswith("_") or (p.is_file() and p.suffix != ".py")) | ||
) | ||
if len(files_without_leading_underscore) > max_file_per_directory: | ||
violations.append((path, len(files_without_leading_underscore))) | ||
|
@@ -86,7 +90,6 @@ def walk(path: Path) -> Iterator[Path]: | |
) | ||
for _file_or_dir in parent_dir_files: | ||
if _file_or_dir.is_dir(): | ||
_files = _get_files_from_dir(_file_or_dir, violations) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The following directory contains too many functional tests files:
- /.../pylint/tests/testutils/data/m: 3 when the max is 1
- /.../pylint/tests/testutils/data/m/max_overflow: 2 when the max is 1
- /.../pylint/tests/testutils/data/m/max_overflow: 2 when the max is 1 |
||
yield _file_or_dir.resolve() | ||
try: | ||
yield from walk(_file_or_dir) | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we adjust the limit here? If I set it to
20
, this is the outputGood to see that
u/used
now only counts as26
when it hit the limit before.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My ide now handle 33 file names vertically now, if you want a new arbitrary number that will prevent having too much work to do right now 😄 (but it doesn't make much sense to base the value on that now). Round number like 40 maybe ?