Repository navigation
Use the obj passed to Class.from_parent - #15247
LuanaPBueno wants to merge 1 commit into
Conversation
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.
Thanks, the change itself looks correct: the new test fails on main and passes here, and going through _getobj() keeps class marks working. Two small things before merging:
- The checklist ticks "Add yourself to
AUTHORS", butAUTHORSis not changed in this PR. Please add yourself. - The commit trailer
Co-authored-by: Claudehas no email, so GitHub does not recognize it as a co-author. The usual form isCo-authored-by: Claude <noreply@anthropic.com>.
Note: this looks like an accidental recreation of a change I already had in my draft #14809 (the ensemble PoC), where Claude made the same fix while I was working on it: the same _given_obj attribute, the same from_parent/_getobj override, and a test that also uses name="NotAnAttribute", obj=... (testing/test_ensemble.py there). That's fine, splitting it out of a large draft is useful. Please mention #14809 in the PR description so the two stay linked, and I'll drop the hunk from #14809 once this is merged.
Generated by Claude Code
|
Hi, about de authors, I didn't actually put my name in this PR as author because Im already in the list (you just merged another Pull Request of mine), but I put as check because I put my name in the authors list in the other PR |
Closes pytest-dev#7063 Co-authored-by: Claude <noreply@anthropic.com>
1b768c8 to
a64d4ab
Compare
Class.from_parent() accepted an obj argument but ignored it, so the class was always looked up again on the parent by name (pytest_pycollect_makeitem even passes obj=obj there). Now the given obj is used, and class marks still work because it goes through _getobj(). I used Claude to help, and reviewed and tested the changes myself.
This overlaps with pytest-dev/pytest#14809, which contains the same fix (an accidental recreation). Once this is merged, the corresponding hunk can be dropped from pytest-dev/pytest#14809.
Closes #7063
closes #XYZWto the PR description and/or commits.Co-authored-bycommit trailers.changelogdirectory.AUTHORSin alphabetical order (I did this in pytest-dev/pytest#15202 (already merged), so my name is already in the list).