From e7557777093a095ee82892993381db1202f62315 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Wed, 28 Feb 2024 10:30:21 -0600 Subject: [PATCH] fix(pytest-filler): Remove collected items without parametrized fork (#452) * fix(pytest-filler): Remove collected items without parametrized fork * changelog --- docs/CHANGELOG.md | 1 + src/pytest_plugins/test_filler/test_filler.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ac7d7757ec..eae0a372b5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -20,6 +20,7 @@ Test fixtures for use by clients are available for each release on the [Github r - 🔀 Helper methods `to_address`, `to_hash` and `to_hash_bytes` have been deprecated in favor of `Address` and `Hash`, which are automatically detected as opcode parameters and pushed to the stack in the resulting bytecode ([#422](https://github.com/ethereum/execution-spec-tests/pull/422)). - ✨ `Opcodes` enum now contains docstrings with each opcode description, including parameters and return values, which show up in many development environments ([#424](https://github.com/ethereum/execution-spec-tests/pull/424)) @ThreeHrSleep. - 🔀 Locally calculate state root for the genesis blocks in the blockchain tests instead of calling t8n ([#450](https://github.com/ethereum/execution-spec-tests/pull/450)). +- 🐞 Fix bug that causes an exception during test collection because the fork parameter contains `None` ([#452](https://github.com/ethereum/execution-spec-tests/pull/452)). ### 🔧 EVM Tools diff --git a/src/pytest_plugins/test_filler/test_filler.py b/src/pytest_plugins/test_filler/test_filler.py index a468d495c2..44cffb5faa 100644 --- a/src/pytest_plugins/test_filler/test_filler.py +++ b/src/pytest_plugins/test_filler/test_filler.py @@ -241,7 +241,7 @@ def do_fixture_verification(request, t8n) -> bool: @pytest.fixture(autouse=True, scope="session") def evm_fixture_verification( request, do_fixture_verification: bool, evm_bin: Path, verify_fixtures_bin: Path -) -> Optional[Generator[TransitionTool, None, None]]: +) -> Generator[Optional[TransitionTool], None, None]: """ Returns the configured evm binary for executing statetest and blocktest commands used to verify generated JSON fixtures. @@ -493,6 +493,9 @@ def pytest_collection_modifyitems(config, items): for item in items[:]: # use a copy of the list, as we'll be modifying it if isinstance(item, EIPSpecTestItem): continue + if "fork" not in item.callspec.params or item.callspec.params["fork"] is None: + items.remove(item) + continue if item.callspec.params["fork"] < Paris: # Even though the `state_test` test spec does not produce a hive STATE_TEST, it does # produce a BLOCKCHAIN_TEST_HIVE, so we need to remove it here.