99import configparser
1010import datetime
1111import os
12+ import re
1213import tarfile
1314import warnings
1415from pathlib import Path
2526from ethereum_clis .clis .geth import FixtureConsumerTool
2627from ethereum_test_base_types import Alloc , ReferenceSpec
2728from 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
2930from ethereum_test_specs import SPEC_TYPES , BaseTest
3031from 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
784800def pytest_sessionfinish (session : pytest .Session , exitstatus : int ):
785801 """
0 commit comments