Skip to content

Fix fixture arg detection for bound methods#14684

Closed
cjc0013 wants to merge 1 commit into
pytest-dev:mainfrom
cjc0013:fix-bound-method-fixture-args
Closed

Fix fixture arg detection for bound methods#14684
cjc0013 wants to merge 1 commit into
pytest-dev:mainfrom
cjc0013:fix-bound-method-fixture-args

Conversation

@cjc0013

@cjc0013 cjc0013 commented Jul 6, 2026

Copy link
Copy Markdown

Fixes #6750.

Summary

  • keep getfuncargnames(..., cls=...) from removing an implicit receiver when the callable is already a bound method
  • preserve existing staticmethod handling and unbound method receiver stripping
  • add regression coverage for unbound, bound, and classmethod callables passed with class context

Testing

  • python -m compileall -q src\_pytest\compat.py
  • manual reproduction for getfuncargnames(A().run_test, name="run_test", cls=A)
  • python -m pytest testing/python/fixtures.py::test_getfuncargnames_methods testing/python/fixtures.py::test_getfuncargnames_staticmethod testing/python/fixtures.py::test_getfuncargnames_staticmethod_inherited testing/python/fixtures.py::test_getfuncargnames_staticmethod_partial -q
  • python -m pytest testing/python/fixtures.py -q
  • uvx ruff check src\_pytest\compat.py testing\python\fixtures.py
  • uvx ruff format --check src\_pytest\compat.py testing\python\fixtures.py
  • git diff --check

AI Assistance

Prepared with AI assistance. I reviewed the patch and validation output and take responsibility for the submission.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 6, 2026
@RonnyPfannschmidt

Copy link
Copy Markdown
Member

Closing as ai slop as the tested behavior and the description contradict each other

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

2 participants