Skip to content

Fix fixture discovery for bound methods in custom collectors - #15058

Open
mtcd001-tech wants to merge 1 commit into
pytest-dev:mainfrom
mtcd001-tech:fix/bound-method-fixtures-6750
Open

mtcd001-tech wants to merge 1 commit into
pytest-dev:mainfrom
mtcd001-tech:fix/bound-method-fixtures-6750

Conversation

@mtcd001-tech

Copy link
Copy Markdown

Fixes #6750.

Custom collectors passing bound methods to pytest.Function can lose the first fixture argument because inspect.signature has already removed the receiver.

Skip the extra removal for bound methods. Add an integration regression covering instance, class, and static methods, including positional-only receivers and keyword-only fixtures.

Validation on Windows with Python 3.11:

  • Regression: four failures before the fix; all five collected tests pass afterward.
  • Related suites: 816 passed, 10 skipped, 3 xfailed.
  • Applicable pre-commit checks passed, including Ruff and mypy.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compat::getfuncargnames removes self from instance method twice by mistake

1 participant