-
-
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
Primer tests "à la mypy" #5173
Primer tests "à la mypy" #5173
Conversation
Pull Request Test Coverage Report for Build 1499050922
💛 - Coveralls |
@Pierre-Sassoulas I took the liberty to work on this some more. I have created a working prototype at DanielNoord#29 If you want to go ahead with what I did there I can commit to this branch directly or create a new PR. There are some additional discussions to be had (as well as a bug identified by the primer tests to be fixed) but I think these commits should help progress this effort along! |
Thank you @DanielNoord much appreciated. I'll take a look before the end of the week. This is definitely helping release 2.12 faster :) |
6e2a885
to
5e638b4
Compare
@DanielNoord it seems like you removed the primer test where we launch without the |
See #5173 (comment) |
Yes, I agree, we can use |
I have also added the check for |
I guess we found another issue.. Good to see this actually works :) |
Reposting this from the other PR so we don't lose it: Some points I found while working on this:
|
I upgraded the description to add a todo list.
I think at first we could only look for crashes or fatal error message. But using project that have a pylint configuration, installing dependencies and using their configuration should help, because if they have a pylint conf it means that errors are really (new) false positives. Maybe something to do after 2.12 release ? |
@Pierre-Sassoulas Thanks for the todo list! I thought about this a little and I think we might want to change the command (again). To summarise:
|
The reasoning for checking for error is that if there is an "error" in a well tested largely used package main branch, it means pylint created a false positive. We don't need to use the
I agree with your three point, but this one is really good as this can be useful for those who want to use all extensions. I'm also thinking about making is possible to disable some extensions because preventing while loop is really opinionated for example. Maybe a |
Doesn't this already happen? When one primer fails, all primers are cancelled.
I'm not sure this is the case. Take We know there are issues with this message. There are false positives and negatives and due to the lack of control-flow we are not able to solve this (now). We can (sort of) avoid this by only including projects that use By only checking for
So you would want to allow the use of |
Yes, that's the idea behind it, being able to handle the false positive during the checker creation and not being flooded by having lot of issues opened right after we release. Sometime the false positive would be unavoidable (need to be disabled in the repo), so it can't be run in github action. But we can add examples to functional tests once we know we need to do them. Right now Marc is checking that kind of thing in its own repository. Let's do that later so 2.12 scope does not increase again though.
This could work the same way than for messages with |
Maybe pylnt tests are too long but in pycodestyle if a single job fail all jobs are canceled. This is not directly linked to primer but as primer would take a lot of time we might have to look into it. |
Ah my bad, I thought we wanted to do primer because of the crashes reported after
Do we want to include creating that option for |
It's the main reason clearly, detecting false positive is a lot harder to do, would take time and verification once it's implemented.
I think we should try to release 2.12 asap so probably 2.13 at least. |
I have a fix ready for the crash which I will push tomorrow morning. Don't have a laptop with internet connection now.. |
Btw, before pushing this to |
I added psycopg and pytest to the list 0ff2f45. |
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.
I would strongly recommend to move the workflows here already. #5173 (comment)
It isn't too difficult either, mostly copy and paste.
@doublethefish Caching was been an ongoing discussion in astroid, just to link one: pylint-dev/astroid#1145. There are multiple issues that make it not trivial to implement. Just know that it's still on our minds but not priority at the moment. |
tests/primer/test_primer_external.py
Outdated
command = ["pylint"] + enables + disables + package.pylint_args | ||
logging.info("Launching primer:\n%s", " ".join(command)) | ||
if PY37_PLUS: | ||
subprocess.run(command, check=True, capture_output=True) |
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.
@cdce8p I just realized that capture_output
prevent us from seeing the current problem in the CI, I'm going to remove it as it's easier to just not capture and let pytest handle it.
@doublethefish thank you for suggesting pyscopg :) We caught yet another crash ! https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_queries.py#L281 Exception on node <If l.281 at 0x7f2f9141a550> pylint crashed with a
|
@Pierre-Sassoulas Where did you find the traceback? I only found the error here: https://github.com/PyCQA/pylint/runs/4286552306?check_suite_focus=true#step:6:38. Am I missing something? Btw. I would suggest to add |
Because of #5173 (comment) I had to reproduce locally I opened #5369 |
|
297a4fb
to
c387e12
Compare
Should be good to go once #5369 is merged and rebased upon. |
In order to anticipate crash/fatal messages, false positives are harder to anticipate. Add '__tracebackhide__ = True' so the traceback is manageable
c387e12
to
c136c5e
Compare
pylint/testutils/primer.py
Outdated
directories: str | ||
"""Directories within the repository to run pylint over""" | ||
|
||
pylint_additional_args: List[str] = [] |
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.
pylint_additional_args: List[str] = [] | |
pylint_additional_args: List[str] |
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
pylint/testutils/primer.py
Outdated
directories: str | ||
"""Directories within the repository to run pylint over""" | ||
|
||
pylint_additional_args: List[str] = [] |
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.
@Pierre-Sassoulas I think you missed this comment (the previous conversation was resolved).
assert package_to_lint.pylint_additional_args == ["--ignore-pattern='re*'"] | ||
assert package_to_lint.paths_to_lint == [str(Path(expected_path_to_lint))] | ||
assert package_to_lint.clone_directory == Path(str(Path(expected_dir_path))) | ||
assert package_to_lint.pylintrc == Path(str(Path(expected_pylintrc_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.
Aren't these Path
by default due to the refactor?
Anyway, Path(str(Path
seems a bit redundant 😄
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.
Harg, you're right, and the 21mn for the pipeline really hurt for small thing like this.. 😓 Let's release 2.12 and focus on 2 primer batch right after that.
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'll need to the end_line
reporter first. We could make this blocked
until that is merged?
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.
I'll merge and do another speed up MR before 2.12.0. This MR is already too big.
Type of Changes
Description
This is a draft for adding primer tests, and discuss about it.
Add more repositories ?Better primer tests (faster, less duplication, more diverse) #5359Reduce total pipeline time (possibly by adding more jobs one for each part of the primer)Better primer tests (faster, less duplication, more diverse) #5359Closes #4413