Skip to content

Fix stats collection crash when tests run mutated code in a subprocess - #644

Open
MartinThoma wants to merge 1 commit into
boxed:mainfrom
MartinThoma:fix-stats-crash-in-subprocess
Open

MartinThoma wants to merge 1 commit into
boxed:mainfrom
MartinThoma:fix-stats-crash-in-subprocess

Conversation

@MartinThoma

Copy link
Copy Markdown
Contributor

Another fix that was necessary for my pypdf <-> mutmut improvement :-)

I typically try negated forms ("config_unavailable"), but "not unavailble" is semantically something different than "is available". If you don't mind about that nitpick and prefer the "config_available", I can adjust the PR :-)

Why I needed this change: pypdf has a few tests that run in a subprocess. A test that runs the package in a subprocess with another working directory passes MUTANT_UNDER_TEST=stats on, so the subprocess's trampolines call record_trampoline_hit, which cannot load the mutmut config there and raises FileNotFoundError. Skip recording in that case; such hits never reach mutmut's stats. Remember the failure so later hits do not reload the config.

A test that runs the package in a subprocess with another working
directory passes MUTANT_UNDER_TEST=stats on, so the subprocess's
trampolines call record_trampoline_hit, which cannot load the mutmut
config there and raises FileNotFoundError. Skip recording in that case;
such hits never reach mutmut's stats. Remember the failure so later hits
do not reload the config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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