-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add CI test for message documentation #5956
Add CI test for message documentation #5956
Conversation
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.
Looks great already ! I think reusing code would make it easier to maintain.
TESTS_NAMES = [f"{t[0]}-{t[1].stem}" for t in TESTS] | ||
|
||
|
||
class LintModuleTest: |
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.
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.
No, as that automatically disables some messages (that we might want to test) and can only accept FunctionalTestFile
as test_file
while we (I think) only want to pass a simple tuple.
MessageCounter = CounterType[Tuple[int, str]] | ||
|
||
|
||
def get_functional_test_files_from_directory(input_dir: Path) -> List[Tuple[str, Path]]: |
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.
We could use https://github.com/PyCQA/pylint/blob/main/pylint/testutils/functional/find_functional_tests.py#L31, right ? ( yield from get_functional_test_files_from_directory if the file is good.py or bad.py ? Maybe we don't even need to check that it's good.py or bad.py)
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.
No, that yields FunctionalTestFile
:
https://github.com/PyCQA/pylint/blob/80838744c6f739fbf2f49bd1bfb70c98a84531aa/pylint/testutils/functional/test_file.py#L45
That class has a lot of additional methods that do not work with the folder structure of the messages documentation. Stuff like self._parse_options()
.
For the purpose of these tests we only need a tuple of test name and path so I don't think it makes much sense to try and change FunctionalTestFile
to also allow a completely different directory structure.
CONTRIBUTORS.txt
if you are a new contributor.Type of Changes
Description
Well, I immediately spotted a mistake...
We could also think about moving the message of
empty-docstring
to thedoc_node
attribute of the definition instead of on the definition line but that's for another PR.Code is based on the functional test runner but I have removed everything that was redundant. I couldn't inherit the class because there was a lot of stuff to handle the
.rc
and.txt
files. This seemed like a simpler approach.I did not put this in the normal test suite as I didn't want to unnecessarily inflate local test runs. This is really something that only should be run before merging so the CI seemed a better fit.