fix(test-tests): prevent race condition in gentest tests w/xdist#2009
Merged
marioevz merged 2 commits intoethereum:forks/amsterdamfrom Jan 12, 2026
Merged
Conversation
Include ruff's stderr output in exceptions when formatting fails, enabling diagnosis of the root cause in CI failures.
Add --no-cache flag to ruff invocation to prevent potential race conditions when pytest-xdist runs tests with multiple workers sharing the same .ruff_cache directory.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2009 +/- ##
================================================
Coverage 86.33% 86.33%
================================================
Files 538 538
Lines 34557 34557
Branches 3222 3222
================================================
Hits 29835 29835
Misses 4148 4148
Partials 574 574
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fselmo
pushed a commit
to fselmo/execution-specs
that referenced
this pull request
Jan 12, 2026
…ereum#2009) * fix(gentest): capture ruff stderr in format error messages Include ruff's stderr output in exceptions when formatting fails, enabling diagnosis of the root cause in CI failures. * fix(gentest): disable ruff cache to prevent parallel test failures Add --no-cache flag to ruff invocation to prevent potential race conditions when pytest-xdist runs tests with multiple workers sharing the same .ruff_cache directory.
8 tasks
CPerezz
pushed a commit
to CPerezz/execution-specs
that referenced
this pull request
Feb 27, 2026
…ereum#2009) * fix(gentest): capture ruff stderr in format error messages Include ruff's stderr output in exceptions when formatting fails, enabling diagnosis of the root cause in CI failures. * fix(gentest): disable ruff cache to prevent parallel test failures Add --no-cache flag to ruff invocation to prevent potential race conditions when pytest-xdist runs tests with multiple workers sharing the same .ruff_cache directory.
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.
🗒️ Description
--no-cacheflag to ruff invocation informat_code()to prevent race conditions when pytest-xdist runs tests with multiple workers (observed in CI for fix(test-types): formatTransactionvalues as readable hex-strings instead of raw bytes (#1803) #1803).Problem
The
test_tx_typetests fail intermittently in CI with error:When multiple pytest-xdist workers run in parallel, they all invoke ruff which tries to read/write the same
.ruff_cachedirectory, causing race conditions.This is the likely culprit for these fails (https://github.com/ethereum/execution-specs/actions/runs/20916668952/job/60091856756?pr=1803):
Investigation
Initial hypothesis was that Click's
CliRunnermight be causing issues, since its documentation states:However, investigation revealed this warning doesn't apply here:
gw0,gw1, etc.) runs in a separate Python process with isolated interpreter statesys.stdin,sys.stdout,os.environ) are confined to each worker's process.ruff_cachedirectoryThis pointed back to the ruff cache as the likely culprit, but without stderr capture we can't be sure.
🔗 Related Issues or PRs
Sporadic fail seen in:
Transactionvalues as readable hex-strings instead of raw bytes (#1803) #1803✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.All: Considered adding an entry to CHANGELOG.md.skippedCute Animal Picture