Skip to content

Commit 689f212

Browse files
committed
fix(consume): add explicit plugin registration for simulator-specific configs
With the move to hive_tests/, the simulator-specific conftest.py files are no longer automatically discovered. Add explicit plugin registration to ensure _supported_fixture_formats and other simulator configs are properly loaded. - Add command_name parameter to HiveEnvironmentProcessor. - Register simulator-specific plugins based on command name. - Update ConsumeCommand to pass command_name to processors. - Fix AttributeError: 'Config' object has no attribute '_supported_fixture_formats'.
1 parent 97c236e commit 689f212

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/cli/pytest_commands/consume.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
class ConsumeCommand(PytestCommand):
1414
"""Pytest command for consume operations."""
1515

16-
def __init__(self, command_paths: List[Path], is_hive: bool = False):
16+
def __init__(self, command_paths: List[Path], is_hive: bool = False, command_name: str = ""):
1717
"""Initialize consume command with paths and processors."""
1818
processors: List[ArgumentProcessor] = [HelpFlagsProcessor("consume")]
1919

2020
if is_hive:
2121
processors.extend(
2222
[
23-
HiveEnvironmentProcessor(),
23+
HiveEnvironmentProcessor(command_name=command_name),
2424
ConsumeCommandProcessor(is_hive=True),
2525
]
2626
)
@@ -88,7 +88,7 @@ def decorator(func: Callable[..., Any]) -> click.Command:
8888
@common_pytest_options
8989
@functools.wraps(func)
9090
def command(pytest_args: List[str], **kwargs) -> None:
91-
consume_cmd = ConsumeCommand(command_paths, is_hive)
91+
consume_cmd = ConsumeCommand(command_paths, is_hive, command_name)
9292
consume_cmd.execute(list(pytest_args))
9393

9494
return command

src/cli/pytest_commands/processors.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ 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):
78+
"""
79+
Initialize the processor with command name to determine plugin.
80+
81+
Args:
82+
command_name: The command name to determine which plugin to load.
83+
84+
"""
85+
self.command_name = command_name
86+
7787
def process_args(self, args: List[str]) -> List[str]:
7888
"""Convert hive environment variables into pytest flags."""
7989
modified_args = args[:]
@@ -94,6 +104,12 @@ def process_args(self, args: List[str]) -> List[str]:
94104

95105
modified_args.extend(["-p", "pytest_plugins.pytest_hive.pytest_hive"])
96106

107+
if self.command_name == "engine":
108+
modified_args.extend(["-p", "pytest_plugins.consume.simulators.engine.conftest"])
109+
elif self.command_name == "rlp":
110+
modified_args.extend(["-p", "pytest_plugins.consume.simulators.rlp.conftest"])
111+
else:
112+
raise ValueError(f"Unknown command name: {self.command_name}")
97113
return modified_args
98114

99115
def _has_regex_or_sim_limit(self, args: List[str]) -> bool:

0 commit comments

Comments
 (0)