Skip to content

🐛 fix(discovery): harden subprocess interrogation and test reliability#3054

Merged
gaborbernat merged 1 commit intopypa:mainfrom
gaborbernat:fix/graceful-cache-and-test-timeout
Feb 18, 2026
Merged

🐛 fix(discovery): harden subprocess interrogation and test reliability#3054
gaborbernat merged 1 commit intopypa:mainfrom
gaborbernat:fix/graceful-cache-and-test-timeout

Conversation

@gaborbernat
Copy link
Contributor

@gaborbernat gaborbernat commented Feb 18, 2026

Python interpreter discovery was failing in edge cases where cached metadata became corrupted or subprocess interrogation encountered transient issues. This manifested as KeyError crashes when loading cached interpreter info and occasional test failures in CI where subprocess calls would timeout or return malformed JSON.

The discovery cache now gracefully handles corrupted entries by catching KeyError and TypeError when deserializing cached data, removing the invalid cache file, and falling back to fresh interrogation. 🔧 Subprocess interrogation also retries once on failure to handle transient issues like process spawning delays or temporary resource exhaustion.

Additionally optimized GraalPy test execution by introducing a marker-based test suite (@pytest.mark.graalpy) that validates core functionality: discovery, venv creation, activation, and integration. This reduces the test count from 1000+ to 30 essential parametrized test cases while maintaining confidence in the core contract.

GraalPy runs 4-6x slower than CPython per their documentation, making full test coverage impractical. The optimized suite focuses on high-value tests rather than edge cases and integration combinations. JIT compilation is disabled for GraalPy tests since the suite runs too briefly to benefit from warmup. Parallelism is limited to 4 workers matching GraalPy's own test infrastructure to prevent resource exhaustion.

@gaborbernat gaborbernat enabled auto-merge (squash) February 18, 2026 14:39
@gaborbernat gaborbernat force-pushed the fix/graceful-cache-and-test-timeout branch 2 times, most recently from f939be0 to 711e66d Compare February 18, 2026 14:50
@gaborbernat gaborbernat marked this pull request as draft February 18, 2026 14:59
auto-merge was automatically disabled February 18, 2026 14:59

Pull request was converted to draft

@gaborbernat gaborbernat force-pushed the fix/graceful-cache-and-test-timeout branch 2 times, most recently from 7e5ecd8 to 9f036b1 Compare February 18, 2026 15:25
@gaborbernat gaborbernat changed the title 🐛 fix(discovery): handle corrupt cache and invalid JSON 🐛 fix: handle corrupt cache, fix flaky tests on Windows Feb 18, 2026
@gaborbernat gaborbernat force-pushed the fix/graceful-cache-and-test-timeout branch 3 times, most recently from 659839e to 9f0a61e Compare February 18, 2026 15:56
@gaborbernat gaborbernat changed the title 🐛 fix: handle corrupt cache, fix flaky tests on Windows 🐛 fix(discovery): harden subprocess interrogation and test reliability Feb 18, 2026
@gaborbernat gaborbernat force-pushed the fix/graceful-cache-and-test-timeout branch from 9f0a61e to ee86f3b Compare February 18, 2026 16:17
…y tests

Python interpreter discovery was failing in edge cases where cached metadata
became corrupted or subprocess interrogation encountered transient issues.
The discovery cache now gracefully handles corrupted entries and subprocess
interrogation retries once on failure.

Additionally optimized GraalPy test execution by introducing a minimal
marker-based test suite that validates core functionality while reducing
test count from 1000+ to 30 parametrized cases. Disabled JIT compilation
and limited parallelism to 4 workers to prevent resource exhaustion.
@gaborbernat gaborbernat force-pushed the fix/graceful-cache-and-test-timeout branch from 57985e2 to f6e3aab Compare February 18, 2026 20:09
@gaborbernat gaborbernat marked this pull request as ready for review February 18, 2026 21:31
@gaborbernat gaborbernat merged commit 6ff2e3e into pypa:main Feb 18, 2026
103 of 104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments