Skip to content

Run pylint standalone instead of via pytest-pylint - #437

Merged
ogajduse merged 1 commit into
theforeman:masterfrom
ogajduse:fix-ci-pytest-pylint-compat
Aug 3, 2026
Merged

Run pylint standalone instead of via pytest-pylint#437
ogajduse merged 1 commit into
theforeman:masterfrom
ogajduse:fix-ci-pytest-pylint-compat

Conversation

@ogajduse

@ogajduse ogajduse commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

CI is currently broken on every PR (unrelated to their actual changes, e.g. #435): build (3.9-3.13) fails with

PluginValidationError: Plugin '...' for hook 'pytest_collect_file'
hookimpl definition: pytest_collect_file(path, parent)
Argument(s) {'path'} are declared in the hookimpl but can not be found in the hookspec

pytest-pylint 0.21.0 (latest release on PyPI) hardcodes the pre-pytest-7 pytest_collect_file(path, parent) hookimpl signature with no version guard (unlike pytest-flakes, which already branches on pytest version internally). pytest 9.0 finally removed the long-deprecated path parameter (slated for removal since 7.0; a premature removal in 8.1.0 was yanked and reverted), so any environment that resolves latest pytest now fails at pytest_configure, before a single test runs.

pytest-pylint looks effectively dead upstream: carsongee/pytest-pylint's last commit was 2024-04-13 (over 2 years ago) — which is also the commit that merged carsongee/pytest-pylint#193 (pathlib.Path in hooks, the actual fix for this) without ever cutting a release containing it. A follow-up pytest-9 compat PR (carsongee/pytest-pylint#196) has sat open and unaddressed since 2025-12-16. So there's no unpinned-pytest-compatible release to wait for, and pinning to their git HEAD would mean depending on an unmaintained, unversioned commit.

Fix

Decouple pylint from pytest's plugin/collection API entirely instead: run it as its own tox command rather than through pytest --pylint. This keeps pytest unpinned/latest and doesn't depend on the health of pytest-pylint at all going forward. .pylintrc already scopes to the obal package via ignore=docs,tests, so pylint --rcfile=.pylintrc obal covers the same files pytest-pylint was checking.

Verification

Fresh venv, latest everything (pytest==9.1.1, pylint==4.0.6): full suite 171 passed, pylint clean (10.00/10).

No other tox/CI/docs config references pytest-pylint or --pylint (checked .github/workflows/, requirements-test.txt, README/docs).

pytest-pylint 0.21.0 (latest release) hardcodes the pre-pytest-7
pytest_collect_file(path, parent) hookimpl signature with no version
guard (unlike pytest-flakes, which already branches on pytest
version). pytest 9.0 finally removed the long-deprecated path
parameter (slated since 7.0, a premature removal in 8.1.0 was yanked),
so any pytest>=9 install now hits:

  PluginValidationError: Argument(s) {'path'} are declared in the
  hookimpl but can not be found in the hookspec

Upstream has a fix (carsongee/pytest-pylint#193, pathlib.Path in
hooks) merged to git but not yet released to PyPI, so pinning to it
would mean depending on an unversioned commit. Decoupling pylint from
pytest's plugin/collection API entirely avoids that dependency and
means this can't break again the next time pytest revs a hook
signature. .pylintrc already scopes to the obal package via
`ignore=docs,tests`, so `pylint --rcfile=.pylintrc obal` covers the
same files pytest-pylint was checking.

Verified with a fresh venv (pytest 9.1.1, pylint 4.0.6): full suite
171 passed, pylint clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ogajduse
ogajduse requested a review from evgeni July 8, 2026 15:56
@ogajduse

ogajduse commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

I wish I could tag the packaging group for review.

@evgeni
evgeni requested a review from a team July 15, 2026 08:59
@evgeni

evgeni commented Jul 15, 2026

Copy link
Copy Markdown
Member

I wish I could tag the packaging group for review.

And why can't you?

@evgeni

evgeni commented Jul 15, 2026

Copy link
Copy Markdown
Member

In obsah we ended up pinning pytest instead: theforeman/obsah#121

Not saying the one solution is better than the other, but we should probably use the same in both places?

(The new pytest also broke other plugins if I recall correctly, even if not used here)

@ogajduse

Copy link
Copy Markdown
Member Author

I wish I could tag the packaging group for review.

And why can't you?

I just can't. Github does not give me the option in the Reviewers menu when I search for packaging in the search box in the dropdown. 🤷

@ogajduse

ogajduse commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

In obsah we ended up pinning pytest instead: theforeman/obsah#121

Not saying the one solution is better than the other, but we should probably use the same in both places?

(The new pytest also broke other plugins if I recall correctly, even if not used here)

quoting from the PR description

arsongee/pytest-pylint's last commit was 2024-04-13

So I'd consider stopping using this pytest plugin in obsah too. Would you like me to raise a PR in obsah too?

@evgeni

evgeni commented Jul 15, 2026

Copy link
Copy Markdown
Member

So I'd consider stopping using this pytest plugin in obsah too. Would you like me to raise a PR in obsah too?

Sounds good to me.

@ogajduse
ogajduse merged commit 4857984 into theforeman:master Aug 3, 2026
8 checks passed
@ogajduse
ogajduse deleted the fix-ci-pytest-pylint-compat branch August 3, 2026 13:48
ogajduse added a commit to theforeman/obsah that referenced this pull request Aug 12, 2026
pytest-pylint 0.21.0 hardcodes the pre-pytest-7 pytest_collect_file(path,
parent) hookimpl signature with no version guard. pytest 9.0 removed the
long-deprecated path parameter, so any environment resolving latest
pytest fails at pytest_configure before a single test runs. The plugin
looks effectively dead upstream: its pytest-9 compat fix was merged
without a release, and a follow-up compat PR has sat open unaddressed.

Decouple pylint from pytest's plugin/collection API entirely: run it as
its own tox command. This lets pytest go back to unpinned/latest and
removes the previous pytest<9.1.0 workaround pin.

See theforeman/obal#437.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants