Skip to content

chore(deps): hold pytest below 9.2 (with the reason and the fix path) - #10

Merged
georgiedekker merged 1 commit into
mainfrom
lane/pytest-hold
Nov 14, 2026
Merged

georgiedekker merged 1 commit into
mainfrom
lane/pytest-hold

Conversation

@nonagenticai-claude

Copy link
Copy Markdown
Contributor

Dependabot #9 (pytest 9.1.1 → 9.2.0) is closed, not merged, because 9.2 is incompatible with how
our tests patch pydantic private attributes.

Reproduced on that PR's tree — uv run --with pytest==9.2.0 pytest tests/unit/test_sandbox_org.py:

pytest result
9.1.1 53 passed
9.2.0 1 passed, 52 errors

All errors are in the autouse _clean fixture, on teardown:

del self.__pydantic_private__[item]      # pydantic/main.py:1186
KeyError: '_platform_repo_grants'
  -> AttributeError: 'Settings' object has no attribute '_platform_repo_grants'

_patch_all() monkeypatches pydantic PrivateAttrs (_sandbox_owners,
_platform_repo_grants, …) on the Settings instance. Under 9.2 the monkeypatch undo takes
pydantic's __delattr__ path, which raises when the key is not in __pydantic_private__.

This PR adds ignore: pytest >=9.2 with the evidence in the comment, so the bump stops reopening
weekly. It is a hold, not a fix: the real fix is _patch_all() setting and restoring through
obj.__pydantic_private__ instead of monkeypatch.setattr, and the comment says so.

🤖 Generated with Claude Code

pytest 9.2 breaks every test that monkeypatches a pydantic PrivateAttr on Settings:
monkeypatch's undo calls pydantic's __delattr__, which raises when the key is not in
__pydantic_private__. Reproduced on #9's tree: 53 passed on 9.1.1, 1 passed + 52
errors on 9.2.0, all in the autouse _clean fixture (tests/unit/test_sandbox_org.py).

An ignore keeps the bump from reopening every week. The real fix, when someone wants
9.2, is in that module's _patch_all(): set and restore through
obj.__pydantic_private__ instead of monkeypatch.setattr.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@georgiedekker
georgiedekker merged commit c3b0a1f into main Nov 14, 2026
8 checks passed
@georgiedekker
georgiedekker deleted the lane/pytest-hold branch November 14, 2026 08:52
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.

1 participant