Skip to content

Commit 2a9ec2d

Browse files
committed
refactor(consume): rename & simplify consume enginex command
1 parent b512c43 commit 2a9ec2d

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

src/cli/pytest_commands/consume.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, command_paths: List[Path], is_hive: bool = False, command_nam
2020
if is_hive:
2121
processors.extend(
2222
[
23-
HiveEnvironmentProcessor(command_name),
23+
HiveEnvironmentProcessor(command_name=command_name),
2424
ConsumeCommandProcessor(is_hive=True),
2525
]
2626
)
@@ -49,13 +49,13 @@ def create_executions(self, pytest_args: List[str]) -> List[PytestExecution]:
4949
]
5050

5151

52-
def get_command_paths(command_name: str) -> List[Path]:
52+
def get_command_paths(command_name: str, is_hive: bool) -> List[Path]:
5353
"""Determine the command paths based on the command name and hive flag."""
5454
base_path = Path("src/pytest_plugins/consume")
5555
if command_name == "hive":
5656
commands = ["rlp", "engine"]
5757
command_paths = [base_path / "simulators" / cmd / f"test_via_{cmd}.py" for cmd in commands]
58-
elif command_name in ["engine", "engine-reorg", "engine_reorg"]:
58+
elif command_name in ["engine", "enginex"]:
5959
command_paths = [base_path / "simulators" / "hive_tests" / "test_via_engine.py"]
6060
elif command_name == "rlp":
6161
command_paths = [base_path / "simulators" / "hive_tests" / "test_via_rlp.py"]
@@ -78,7 +78,7 @@ def consume_command(is_hive: bool = False) -> Callable[[Callable[..., Any]], cli
7878
def decorator(func: Callable[..., Any]) -> click.Command:
7979
command_name = func.__name__
8080
command_help = func.__doc__
81-
command_paths = get_command_paths(command_name)
81+
command_paths = get_command_paths(command_name, is_hive)
8282

8383
@consume.command(
8484
name=command_name,
@@ -110,24 +110,14 @@ def rlp() -> None:
110110

111111
@consume_command(is_hive=True)
112112
def engine() -> None:
113-
"""Client consumes via the Engine API."""
113+
"""Client consumes Engine Fixtures via the Engine API."""
114114
pass
115115

116116

117-
@consume.command(
118-
name="engine-reorg",
119-
help="Client consumes via the Engine API with reorg fixtures.",
120-
context_settings={"ignore_unknown_options": True},
121-
)
122-
@common_pytest_options
123-
def engine_reorg(
124-
pytest_args: List[str], help_flag: bool = False, pytest_help_flag: bool = False
125-
) -> None:
126-
"""Client consumes via the Engine API with reorg fixtures."""
127-
command_name = "engine_reorg" # Use underscore for internal logic
128-
command_paths = get_command_paths(command_name)
129-
consume_cmd = ConsumeCommand(command_paths, is_hive=True, command_name=command_name)
130-
consume_cmd.execute(list(pytest_args))
117+
@consume_command(is_hive=True)
118+
def enginex() -> None:
119+
"""Client consumes Engine X Fixtures via the Engine API."""
120+
pass
131121

132122

133123
@consume_command(is_hive=True)
@@ -140,7 +130,7 @@ def hive() -> None:
140130
context_settings={"ignore_unknown_options": True},
141131
)
142132
@common_pytest_options
143-
def cache(pytest_args: List[str], help_flag: bool = False, pytest_help_flag: bool = False) -> None:
133+
def cache(pytest_args: List[str], **kwargs) -> None:
144134
"""Consume command to cache test fixtures."""
145-
cache_cmd = ConsumeCommand([], is_hive=False, command_name="cache")
135+
cache_cmd = ConsumeCommand([], is_hive=False)
146136
cache_cmd.execute(list(pytest_args))

src/cli/pytest_commands/processors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _is_writing_to_stdout(self, args: List[str]) -> bool:
7474
class HiveEnvironmentProcessor(ArgumentProcessor):
7575
"""Processes Hive environment variables for consume commands."""
7676

77-
def __init__(self, command_name: str = ""):
77+
def __init__(self, command_name: str):
7878
"""
7979
Initialize the processor with command name to determine plugin.
8080
@@ -106,7 +106,7 @@ def process_args(self, args: List[str]) -> List[str]:
106106

107107
if self.command_name == "engine":
108108
modified_args.extend(["-p", "pytest_plugins.consume.simulators.engine.conftest"])
109-
elif self.command_name == "engine_reorg":
109+
elif self.command_name == "enginex":
110110
modified_args.extend(["-p", "pytest_plugins.consume.simulators.engine_reorg.conftest"])
111111
elif self.command_name == "rlp":
112112
modified_args.extend(["-p", "pytest_plugins.consume.simulators.rlp.conftest"])

whitelist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,7 @@ Typechecking
10611061
groupstats
10621062
SharedPreStateGroup
10631063
zkEVMs
1064+
enginex
10641065
qube
10651066
aspell
10661067
codespell

0 commit comments

Comments
 (0)