-
Notifications
You must be signed in to change notification settings - Fork 3
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
Missing pytest.CollectReport when invoking pylint with plugin enabled #45
Comments
Verified it isn't there:
...
from _pytest.nodes import Collector
... |
Hello @mcstoufer! Apologies for the very long time it has taken me to respond to your issue. I will do some digging and try to make a plan to mitigate your issue tonight. However, for the sake of completeness, may I ask: Why are you using "such an outdated" pytest version? 😕
|
Indeed, it seems that this is a pytest-7.0.0rc1 thing: https://github.com/pytest-dev/pytest/blob/6.2.x/src/_pytest/reports.py#L342-L344 I'll do a if TYPE_CHECKING:
try:
from pytest import CollectReport
except ImportError:
from _pytest.reports import CollectReport here
However, do note that the last bugfix of v6.2.5 was 2021-08-29 (https://docs.pytest.org/en/6.2.x/changelog.html#pytest-6-2-5-2021-08-29). I'd suggest you'd updated either way 🙏 |
Fixes: #45 Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
Confirmed for me upgrading to pytest 8 (from 6.2.5) fixed the issue. |
Thank you very much for responding! Would you kindly test https://github.com/pylint-dev/pylint-pytest/tree/fix/45/missing-pytest.CollectReportin-pytest-6? I would want to push that fix regardless (I do have a pipeline, but I'd like a human validation regardless 🙏) |
Describe the bug
PyLint generation causes stack trace when the pylint-pytest plugin is enabled.
To Reproduce
Package versions
$ pylint --version
pylint 3.0.2
astroid 3.0.1
Python 3.11.7 (main, Dec 4 2023, 18:10:11) [Clang 15.0.0 (clang-1500.1.0.2.5)]
$ pytest --version
pytest 6.2.5
pylint --output-format=json:pylint.json,parseable tests/test_add_coverage_report_to_pr.py > pylint_report.out
Folder structure
File content
pylint output with the plugin
(Optional) pytest output from fixture collection
Expected behavior
The linting report is generated in both JSON and test output.
Additional context
This works just fine w/o the pylint-pytest plugin enabled in the .pylintrc file.
The text was updated successfully, but these errors were encountered: