Skip to content

Commit 4cdcbb9

Browse files
authored
fix(execute,fill): Fix warnings due to labels being unknown markers (#1238)
1 parent b19b4ca commit 4cdcbb9

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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)).
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)).
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)).

src/ethereum_test_execution/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class LabeledExecuteFormat:
4646
format: Type[BaseExecute]
4747
label: str
4848

49+
registered_labels: ClassVar[Dict[str, "LabeledExecuteFormat"]] = {}
50+
4951
def __init__(self, execute_format: "Type[BaseExecute] | LabeledExecuteFormat", label: str):
5052
"""Initialize the execute format with a custom label."""
5153
self.format = (
@@ -54,6 +56,8 @@ def __init__(self, execute_format: "Type[BaseExecute] | LabeledExecuteFormat", l
5456
else execute_format
5557
)
5658
self.label = label
59+
if label not in LabeledExecuteFormat.registered_labels:
60+
LabeledExecuteFormat.registered_labels[label] = self
5761

5862
@property
5963
def format_name(self) -> str:

src/ethereum_test_fixtures/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ class LabeledFixtureFormat:
155155
format: Type[BaseFixture]
156156
label: str
157157

158+
registered_labels: ClassVar[Dict[str, "LabeledFixtureFormat"]] = {}
159+
158160
def __init__(self, fixture_format: "Type[BaseFixture] | LabeledFixtureFormat", label: str):
159161
"""Initialize the fixture format with a custom label."""
160162
self.format = (
@@ -163,6 +165,8 @@ def __init__(self, fixture_format: "Type[BaseFixture] | LabeledFixtureFormat", l
163165
else fixture_format
164166
)
165167
self.label = label
168+
if label not in LabeledFixtureFormat.registered_labels:
169+
LabeledFixtureFormat.registered_labels[label] = self
166170

167171
@property
168172
def format_name(self) -> str:

src/pytest_plugins/shared/execute_fill.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import pytest
77

8-
from ethereum_test_execution import BaseExecute
9-
from ethereum_test_fixtures import BaseFixture
8+
from ethereum_test_execution import BaseExecute, LabeledExecuteFormat
9+
from ethereum_test_fixtures import BaseFixture, LabeledFixtureFormat
1010
from ethereum_test_forks import (
1111
Fork,
1212
get_closest_fork_with_solc_support,
@@ -39,12 +39,22 @@ def pytest_configure(config: pytest.Config):
3939
"markers",
4040
(f"{fixture_format.format_name.lower()}: {fixture_format.description}"),
4141
)
42+
for label, labeled_fixture_format in LabeledFixtureFormat.registered_labels.items():
43+
config.addinivalue_line(
44+
"markers",
45+
(f"{label}: Custom label for {labeled_fixture_format.format.format_name}."),
46+
)
4247
elif config.pluginmanager.has_plugin("pytest_plugins.execute.execute"):
4348
for execute_format in BaseExecute.formats.values():
4449
config.addinivalue_line(
4550
"markers",
4651
(f"{execute_format.format_name.lower()}: {execute_format.description}"),
4752
)
53+
for label, labeled_execute_format in LabeledExecuteFormat.registered_labels.items():
54+
config.addinivalue_line(
55+
"markers",
56+
(f"{label}: Custom label for {labeled_execute_format.format.format_name}."),
57+
)
4858
else:
4959
raise Exception("Neither the filler nor the execute plugin is loaded.")
5060

0 commit comments

Comments
 (0)