Skip to content

fix(spec-specs): tolerate a missing fork cache at json_loader teardown - #3460

Open
mkzung wants to merge 1 commit into
ethereum:forks/amsterdamfrom
mkzung:fix/json-loader-teardown-missing-fork-cache
Open

fix(spec-specs): tolerate a missing fork cache at json_loader teardown#3460
mkzung wants to merge 1 commit into
ethereum:forks/amsterdamfrom
mkzung:fix/json-loader-teardown-missing-fork-cache

Conversation

@mkzung

@mkzung mkzung commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

tests/json_loader/conftest.py closes a fork cache in pytest_sessionfinish that its own pytest_sessionstart may never have created. pytest registers a directory's conftest before session start only when that directory is named on the command line; reached by collection it arrives after, so the start hook here never runs while the finish hook still does.

Any run over tests/ that does not name tests/json_loader hits it. The test passes, the session then dies in teardown, prints no summary and exits 1:

$ uv run pytest tests -k test_decode_max_withdrawal_amount
.                                                          [100%]Traceback (most recent call last):
...
KeyError: <_pytest.stash.StashKey object at 0x10de06440>
$ echo $?
1

Guarding the read matches the stash.get(key, None) reads in plugins/forks/forks.py and plugins/consume/simulators/helpers/test_tracker.py. The same command then reports 1 passed, 18066 deselected and exits 0.

test_conftest.py covers both directions: reverting the guard fails the empty-stash test with the same KeyError, and deleting the teardown body outright fails the other on assert cache.closed.

Related Issues or PRs

N/A.

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <title>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

   |\---/|
   | o_o |
    \_^_/

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