Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,7 @@ logs/

env.yaml

# Client binary config (user-specific paths)
validate.toml

site/
2 changes: 2 additions & 0 deletions packages/testing/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ checkfixtures = "execution_testing.cli.check_fixtures:check_fixtures"
check_eip_versions = "execution_testing.cli.pytest_commands.check_eip_versions:check_eip_versions"
consume = "execution_testing.cli.pytest_commands.consume:consume"
protec = "execution_testing.cli.pytest_commands.consume:consume"
validate = "execution_testing.cli.pytest_commands.validate:validate"
checklist = "execution_testing.cli.pytest_commands.checklist:checklist"
generate_checklist_stubs = "execution_testing.cli.generate_checklist_stubs:generate_checklist_stubs"
genindex = "execution_testing.cli.gen_index:generate_fixtures_index_cli"
Expand Down Expand Up @@ -134,6 +135,7 @@ addopts = [
"--ignore=src/execution_testing/cli/pytest_commands/plugins/consume/test_cache.py",
"--ignore=src/execution_testing/cli/pytest_commands/plugins/consume/direct/",
"--ignore=src/execution_testing/cli/pytest_commands/plugins/consume/simulators/",
"--ignore=src/execution_testing/cli/pytest_commands/plugins/validate/",
]
markers = [
"pre_alloc_group: Custom marker for pre-allocation grouping",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ def get_command_logic_test_paths(command_name: str) -> List[Path]:
command_logic_test_paths = [
base_path / "simulators" / "simulator_logic" / "test_via_sync.py"
]
elif command_name == "direct":
command_logic_test_paths = [
base_path / "direct" / "test_via_direct.py"
]
else:
raise ValueError(f"Unexpected command: {command_name}.")
return command_logic_test_paths
Expand All @@ -70,6 +66,8 @@ def consume() -> None:
pass




def consume_command(
is_hive: bool = False,
) -> Callable[[Callable[..., Any]], click.Command]:
Expand Down Expand Up @@ -102,12 +100,6 @@ def command(pytest_args: List[str], **kwargs: Any) -> None:
return decorator


@consume_command(is_hive=False)
def direct() -> None:
"""Clients consume directly via the `blocktest` interface."""
pass


@consume_command(is_hive=True)
def rlp() -> None:
"""Client consumes RLP-encoded blocks on startup."""
Expand Down Expand Up @@ -144,3 +136,5 @@ def cache(pytest_args: List[str], **kwargs: Any) -> None:
command_logic_test_paths=[], is_hive=False
)
cache_cmd.execute(list(pytest_args))


Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ def pytest_addoption(parser: pytest.Parser) -> None:
"Show help options specific to the execute hive command and exit."
),
)
help_group.addoption(
"--validate-help",
action="store_true",
dest="show_validate_help",
default=False,
help=(
"Show help options specific to the validate command "
"and exit."
),
)
help_group.addoption(
"--execute-recover-help",
action="store_true",
Expand Down Expand Up @@ -116,6 +126,16 @@ def pytest_configure(config: pytest.Config) -> None:
"consuming",
],
)
elif config.getoption("show_validate_help"):
show_specific_help(
config,
"pytest-validate.ini",
[
"validating fixtures",
"fixture input",
"debug behavior",
],
)
elif config.getoption("show_execute_help"):
show_specific_help(
config,
Expand Down Expand Up @@ -199,7 +219,10 @@ def show_specific_help(
kwargs["type"] = action.type
if action.nargs:
kwargs["nargs"] = action.nargs
new_group.add_argument(*action.option_strings, **kwargs)
try:
new_group.add_argument(*action.option_strings, **kwargs)
except argparse.ArgumentError:
pass # skip conflicting options (e.g. -h/--help)

print(test_parser.format_help())
pytest.exit("After displaying help.", returncode=pytest.ExitCode.OK)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Pytest plugins for validate commands."""
Loading