Skip to content

Commit 4a010a1

Browse files
committed
feat(tests/static): Mark tagged / untagged tests
- Add marker for tagged + untagged tests to make them easier to identify
1 parent 8d2c367 commit 4a010a1

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/ethereum_test_specs/static_state/state_static.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@ def parse_indexes(
101101

102102
def fill_function(self) -> Callable:
103103
"""Return a StateTest spec from a static file."""
104+
# Check if this test uses tags
105+
has_tags = False
106+
tx_tag_dependencies = self.transaction.tag_dependencies()
107+
if tx_tag_dependencies:
108+
has_tags = True
109+
else:
110+
# Check expect sections for tags
111+
for expect in self.expect:
112+
result_tag_dependencies = expect.result.tag_dependencies()
113+
if result_tag_dependencies:
114+
has_tags = True
115+
break
116+
104117
d_g_v_parameters: List[ParameterSet] = []
105118
for d in self.transaction.data:
106119
for g in range(len(self.transaction.gas_limit)):
@@ -162,6 +175,11 @@ def test_state_vectors(
162175
apply_mark = getattr(pytest.mark, mark)
163176
test_state_vectors = apply_mark(test_state_vectors)
164177

178+
if has_tags:
179+
test_state_vectors = pytest.mark.tagged(test_state_vectors)
180+
else:
181+
test_state_vectors = pytest.mark.untagged(test_state_vectors)
182+
165183
return test_state_vectors
166184

167185
def get_valid_at_forks(self) -> List[str]:

src/pytest_plugins/shared/execute_fill.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ def pytest_configure(config: pytest.Config):
9393
"derived_test: Mark a test as a derived test (E.g. a BlockchainTest that is derived "
9494
"from a StateTest).",
9595
)
96+
config.addinivalue_line(
97+
"markers",
98+
"tagged: Marks a static test as tagged. Tags are used to generate dynamic "
99+
"addresses for static tests at fill time. All tagged tests are compatible with "
100+
"dynamic address generation.",
101+
)
102+
config.addinivalue_line(
103+
"markers",
104+
"untagged: Marks a static test as untagged. Tags are used to generate dynamic "
105+
"addresses for static tests at fill time. Untagged tests are incompatible with "
106+
"dynamic address generation.",
107+
)
96108

97109

98110
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)