Skip to content

fix(tests): register JSON fixture fork marker#3053

Open
JackCC703 wants to merge 1 commit into
ethereum:forks/amsterdamfrom
JackCC703:issue-1407-register-fork-marker
Open

fix(tests): register JSON fixture fork marker#3053
JackCC703 wants to merge 1 commit into
ethereum:forks/amsterdamfrom
JackCC703:issue-1407-register-fork-marker

Conversation

@JackCC703

Copy link
Copy Markdown
Contributor

🗒️ Description

Register the fork(name) pytest marker used by JSON fixture tests.

JSON fixture collection adds pytest.mark.fork(...) to collected tests, but the marker was not registered in the root pytest configuration. This caused PytestUnknownMarkWarning during pytest runs. Registering the marker in pyproject.toml silences the warning without changing test behavior.

🔗 Related Issues or PRs

Fixes #1407.

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

Cute animal picture

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.22%. Comparing base (3f888bc) to head (3ec94e0).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #3053   +/-   ##
================================================
  Coverage            93.22%   93.22%           
================================================
  Files                  624      624           
  Lines                36926    36926           
  Branches              3377     3377           
================================================
  Hits                 34424    34424           
  Misses                1708     1708           
  Partials               794      794           
Flag Coverage Δ
unittests 93.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danceratopz danceratopz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, #1407 is an old issue and I don't think it's required any longer. Could you share the command you're using and the warnings that this change fixes? I.e., can you still reproduce them locally before this change. I had a quick go and couldn't create the warnings.

Comment thread pyproject.toml Outdated
"json_state_tests: marks tests as json_state_tests (deselect with '-m \"not json_state_tests\"')",
"vm_test: marks tests as vm_test (deselect with '-m \"not vm_test\"')",
"eels_base_coverage: Minimized subset selected to preserve high EELS line-coverage parity (select with '-m eels_base_coverage')",
"fork(name): marks JSON fixture tests by fork",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this would actually match any marker as name is not a valid fork name (as noted in #1407).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I updated the marker registration from fork(name) to fork: ... to
avoid implying that name is a fork value.

@JackCC703 JackCC703 force-pushed the issue-1407-register-fork-marker branch from 3ec94e0 to 92aa3b8 Compare June 26, 2026 07:06
@JackCC703

Copy link
Copy Markdown
Contributor Author

Oh, Sorry. I think the difference is that my checkout has generated JSON fixtures under tests/json_loader/fixtures/, which are ignored by git. A clean checkout does not have those files, so the warning won't appear unless that generated fixture collection workflow is used.

So this PR only fixes the warning for collecting generated JSON fixtures, not for a clean default pytest run. Since the issue is old, if that workflow is no longer considered supported or relevant, I'm happy to close this PR.

@JackCC703

JackCC703 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

On origin/forks/amsterdam, with a generated JSON fixture present under
tests/json_loader/fixtures/, I can reproduce it with:

.venv/bin/pytest --collect-only -q tests/json_loader/fixtures/blockchain_tests/for_frontier/frontier/validation/transaction/sender_balance.json -W "error::pytest.PytestUnknownMarkWarning"

This fails before the change with:

E   pytest.PytestUnknownMarkWarning: Unknown pytest.mark.fork - is this a typo?  You can register custom marks to avoid this warning

The warning is triggered from:

self.add_marker(pytest.mark.fork(self.fork_name))

in tests/json_loader/helpers/load_blockchain_tests.py.

After this PR, the same command passes with PytestUnknownMarkWarning
configured to fail the run, which confirms that the warning is no longer emitted.

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.

Register per-fork custom marks in pytest_configure or pyproject.toml

3 participants