Repository navigation
Fix serialization of str subclasses in subtest msg parameter - #15134
Open
RonnyPfannschmidt wants to merge 1 commit into
Open
RonnyPfannschmidt wants to merge 1 commit into
RonnyPfannschmidt wants to merge 1 commit into
Conversation
RonnyPfannschmidt
pushed a commit
that referenced
this pull request
Oct 5, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014AXM2385U5x4VaR1ppeo4X
A str subclass passed as the subtest msg, such as a StrEnum member, was stored on the report as-is. execnet serializes by exact type, so pytest-xdist failed with "DumpError: can't serialize <enum ...>". Convert such messages with str.__str__ in SubtestContext, next to the existing saferepr handling of kwargs. str.__str__ keeps the string data; str() on a (str, Enum) mixin would give "Cls.MEMBER". Refs pytest-dev/pytest-xdist#1161. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014AXM2385U5x4VaR1ppeo4X
RonnyPfannschmidt
force-pushed
the
claude/project-thread-pe7mtw
branch
from
October 5, 2026 08:14
e368520 to
6fc8c29
Compare
RonnyPfannschmidt
marked this pull request as ready for review
October 5, 2026 08:18
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ronny · project thread
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.
Reports must be serializable, so the report producer is responsible for handing over plain data.
SubtestContextalready does this forkwargs(#13963), andTestCase.subTestconverts its message (#14196). The nativesubtests.test(msg=...)path did not: astrsubclass such as aStrEnummember stayed on the report, and pytest-xdist failed withDumpError: can't serialize <enum ...>.SubtestContextnow convertsstrsubclasses to plainstrviastr.__str__, which keeps the string data (str()on a(str, Enum)mixin would yield"Cls.MEMBER").Fixes pytest-dev/pytest-xdist#1161, in place of the xdist-side workaround in pytest-dev/pytest-xdist#1389.
🤖 Generated with Claude Code
https://claude.ai/code/session_014AXM2385U5x4VaR1ppeo4X