Skip to content

Commit ed958b8

Browse files
authored
fix(fill,execute): register new label type markers to prevent warnings (#1245)
1 parent 4cdcbb9 commit ed958b8

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

docs/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ Test fixtures for use by clients are available for each release on the [Github r
1111
### 🛠️ Framework
1212

1313
- 🔀 Make `BaseFixture` able to parse any fixture format such as `BlockchainFixture` ([#1210](https://github.com/ethereum/execution-spec-tests/pull/1210)).
14-
- ✨ Blockchain and Blockchain-Engine tests now have a marker to specify that they were generated from a state test, which can be used with `-m blockchain_test_from_state_test` and `-m blockchain_test_engine_from_state_test` respectively ([#1220](https://github.com/ethereum/execution-spec-tests/pull/1220), [#1238](https://github.com/ethereum/execution-spec-tests/pull/1238)).
14+
- ✨ Blockchain and Blockchain-Engine tests now have a marker to specify that they were generated from a state test, which can be used with `-m blockchain_test_from_state_test` and `-m blockchain_test_engine_from_state_test` respectively ([#1220](https://github.com/ethereum/execution-spec-tests/pull/1220)).
1515
- ✨ Blockchain and Blockchain-Engine tests that were generated from a state test now have `blockchain_test_from_state_test` or `blockchain_test_engine_from_state_test` as part of their test IDs ([#1220](https://github.com/ethereum/execution-spec-tests/pull/1220)).
1616
- 🔀 Refactor `ethereum_test_fixtures` and `ethereum_clis` to create `FixtureConsumer` and `FixtureConsumerTool` classes which abstract away the consumption process used by `consume direct` ([#935](https://github.com/ethereum/execution-spec-tests/pull/935)).
1717
- ✨ Allow `consume direct --collect-only` without specifying a fixture consumer binary on the command-line ([#1237](https://github.com/ethereum/execution-spec-tests/pull/1237)).
1818
- ✨ Report the (resolved) fixture tarball URL and local fixture cache directory when `consume`'s `--input` flag is a release spec or URL [#1239](https://github.com/ethereum/execution-spec-tests/pull/1239).
1919
- ✨ EOF Container validation tests (`eof_test`) now generate container deployment state tests, by wrapping the EOF container in an init-container and sending a deploy transaction ([#783](https://github.com/ethereum/execution-spec-tests/pull/783), [#1233](https://github.com/ethereum/execution-spec-tests/pull/1233)).
2020
- ✨ Use regexes for Hive's `--sim.limit` argument and don't use xdist if `--sim.parallelism==1` in the `eest/consume-rlp` and `eest/consume-rlp` simulators ([#1220](https://github.com/ethereum/execution-spec-tests/pull/1220)).
21+
- 🐞 Register generated test markers, e.g., `blockchain_test_from_state_test`, to prevent test session warnings ([#1238](https://github.com/ethereum/execution-spec-tests/pull/1238), [#1245](https://github.com/ethereum/execution-spec-tests/pull/1245)).
2122

2223
### 📋 Misc
2324

src/ethereum_test_execution/base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,24 @@ class LabeledExecuteFormat:
4545

4646
format: Type[BaseExecute]
4747
label: str
48+
description: str
4849

4950
registered_labels: ClassVar[Dict[str, "LabeledExecuteFormat"]] = {}
5051

51-
def __init__(self, execute_format: "Type[BaseExecute] | LabeledExecuteFormat", label: str):
52+
def __init__(
53+
self,
54+
execute_format: "Type[BaseExecute] | LabeledExecuteFormat",
55+
label: str,
56+
description: str,
57+
):
5258
"""Initialize the execute format with a custom label."""
5359
self.format = (
5460
execute_format.format
5561
if isinstance(execute_format, LabeledExecuteFormat)
5662
else execute_format
5763
)
5864
self.label = label
65+
self.description = description
5966
if label not in LabeledExecuteFormat.registered_labels:
6067
LabeledExecuteFormat.registered_labels[label] = self
6168

src/ethereum_test_fixtures/base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,24 @@ class LabeledFixtureFormat:
154154

155155
format: Type[BaseFixture]
156156
label: str
157+
description: str
157158

158159
registered_labels: ClassVar[Dict[str, "LabeledFixtureFormat"]] = {}
159160

160-
def __init__(self, fixture_format: "Type[BaseFixture] | LabeledFixtureFormat", label: str):
161+
def __init__(
162+
self,
163+
fixture_format: "Type[BaseFixture] | LabeledFixtureFormat",
164+
label: str,
165+
description: str,
166+
):
161167
"""Initialize the fixture format with a custom label."""
162168
self.format = (
163169
fixture_format.format
164170
if isinstance(fixture_format, LabeledFixtureFormat)
165171
else fixture_format
166172
)
167173
self.label = label
174+
self.description = description
168175
if label not in LabeledFixtureFormat.registered_labels:
169176
LabeledFixtureFormat.registered_labels[label] = self
170177

src/ethereum_test_specs/eof.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ class EOFTest(BaseTest):
236236
LabeledFixtureFormat(
237237
fixture_format,
238238
f"{fixture_format.format_name}_from_eof_test",
239+
f"A {fixture_format.format_name} generated from an eof_test.",
239240
)
240241
for fixture_format in StateTest.supported_fixture_formats
241242
]
@@ -244,6 +245,7 @@ class EOFTest(BaseTest):
244245
LabeledExecuteFormat(
245246
execute_format,
246247
f"{execute_format.format_name}_from_eof_test",
248+
f"A {execute_format.format_name} generated from an eof_test.",
247249
)
248250
for execute_format in StateTest.supported_execute_formats
249251
]
@@ -519,6 +521,7 @@ class EOFStateTest(EOFTest, Transaction):
519521
LabeledFixtureFormat(
520522
fixture_format,
521523
f"eof_{fixture_format.format_name}",
524+
f"Tests that generate an EOF {fixture_format.format_name}.",
522525
)
523526
for fixture_format in StateTest.supported_fixture_formats
524527
]
@@ -527,6 +530,7 @@ class EOFStateTest(EOFTest, Transaction):
527530
LabeledExecuteFormat(
528531
execute_format,
529532
f"eof_{execute_format.format_name}",
533+
f"Tests that generate an EOF {execute_format.format_name}.",
530534
)
531535
for execute_format in StateTest.supported_execute_formats
532536
]

src/ethereum_test_specs/state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class StateTest(BaseTest):
5454
LabeledFixtureFormat(
5555
fixture_format,
5656
f"{fixture_format.format_name}_from_state_test",
57+
f"A {fixture_format.format_name} generated from a state_test",
5758
)
5859
for fixture_format in BlockchainTest.supported_fixture_formats
5960
]

src/pytest_plugins/shared/execute_fill.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def pytest_configure(config: pytest.Config):
4242
for label, labeled_fixture_format in LabeledFixtureFormat.registered_labels.items():
4343
config.addinivalue_line(
4444
"markers",
45-
(f"{label}: Custom label for {labeled_fixture_format.format.format_name}."),
45+
(f"{label}: {labeled_fixture_format.description}"),
4646
)
4747
elif config.pluginmanager.has_plugin("pytest_plugins.execute.execute"):
4848
for execute_format in BaseExecute.formats.values():
@@ -53,7 +53,7 @@ def pytest_configure(config: pytest.Config):
5353
for label, labeled_execute_format in LabeledExecuteFormat.registered_labels.items():
5454
config.addinivalue_line(
5555
"markers",
56-
(f"{label}: Custom label for {labeled_execute_format.format.format_name}."),
56+
(f"{label}: {labeled_execute_format.description}"),
5757
)
5858
else:
5959
raise Exception("Neither the filler nor the execute plugin is loaded.")

0 commit comments

Comments
 (0)