Skip to content

Commit ad3ac5a

Browse files
committed
chore(fill): fix transition fork state test node ids.
1 parent e04edbe commit ad3ac5a

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/ethereum_test_forks/transition_base_fork.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ class NewTransitionClass(
4949
def transitions_to(cls) -> Fork:
5050
return to_fork
5151

52+
@classmethod
53+
def transitions_from(cls) -> Fork:
54+
return from_fork
55+
5256
NewTransitionClass.name = lambda: transition_name # type: ignore
5357

5458
def make_transition_method(

src/pytest_plugins/filler/filler.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import configparser
1010
import datetime
1111
import os
12+
import re
1213
import tarfile
1314
import warnings
1415
from pathlib import Path
@@ -25,7 +26,7 @@
2526
from ethereum_clis.clis.geth import FixtureConsumerTool
2627
from ethereum_test_base_types import Alloc, ReferenceSpec
2728
from ethereum_test_fixtures import BaseFixture, FixtureCollector, FixtureConsumer, TestInfo
28-
from ethereum_test_forks import Fork
29+
from ethereum_test_forks import Fork, get_transition_forks
2930
from ethereum_test_specs import SPEC_TYPES, BaseTest
3031
from ethereum_test_tools.utility.versioning import (
3132
generate_github_url,
@@ -753,7 +754,9 @@ def pytest_collection_modifyitems(config: pytest.Config, items: List[pytest.Item
753754
Remove pre-Paris tests parametrized to generate hive type fixtures; these
754755
can't be used in the Hive Pyspec Simulator.
755756
756-
This can't be handled in this plugins pytest_generate_tests() as the fork
757+
Replaces the test ID for state tests that use a transition fork with the base fork.
758+
759+
These can't be handled in this plugins pytest_generate_tests() as the fork
757760
parametrization occurs in the forks plugin.
758761
"""
759762
for item in items[:]: # use a copy of the list, as we'll be modifying it
@@ -780,6 +783,19 @@ def pytest_collection_modifyitems(config: pytest.Config, items: List[pytest.Item
780783
if "yul" in item.fixturenames: # type: ignore
781784
item.add_marker(pytest.mark.yul_test)
782785

786+
# Update test ID for state tests that use a transition fork
787+
if fork in get_transition_forks():
788+
has_state_test = any(marker.name == "state_test" for marker in markers)
789+
has_valid_transition = any(
790+
marker.name == "valid_at_transition_to" for marker in markers
791+
)
792+
if has_state_test and has_valid_transition:
793+
base_fork = fork.transitions_from()
794+
item._nodeid = item._nodeid.replace(
795+
f"fork_{fork.name()}",
796+
f"fork_{base_fork.name()}",
797+
)
798+
783799

784800
def pytest_sessionfinish(session: pytest.Session, exitstatus: int):
785801
"""

0 commit comments

Comments
 (0)