Skip to content

Commit a9fc85e

Browse files
committed
feat(test,cli): --skip-summary for phase1 account counting with enginex
1 parent a7603b1 commit a9fc85e

2 files changed

Lines changed: 69 additions & 26 deletions

File tree

  • .github/configs
  • packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler

.github/configs/feature.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# Unless filling for special features, all features should fill for previous forks (starting from Frontier) too
22
stable:
33
evm-type: stable
4-
fill-params: --no-html --until=Prague --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest
4+
fill-params: --no-html --skip-summary --until=Prague --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest
55

66
develop:
77
evm-type: develop
8-
fill-params: --no-html --until=BPO4 --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest
8+
fill-params: --no-html --skip-summary --until=BPO4 --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest
99

1010
benchmark:
1111
evm-type: benchmark
12-
fill-params: --no-html --fork=Prague --gas-benchmark-values 1,5,10,30,60,100,150 -m benchmark ./tests/benchmark
12+
fill-params: --no-html --skip-summary --fork=Prague --gas-benchmark-values 1,5,10,30,60,100,150 -m benchmark ./tests/benchmark
1313

1414
benchmark_develop:
1515
evm-type: benchmark
16-
fill-params: --no-html --fork=Osaka --gas-benchmark-values 1,5,10,30,60,100,150 -m "benchmark" ./tests/benchmark
16+
fill-params: --no-html --skip-summary --fork=Osaka --gas-benchmark-values 1,5,10,30,60,100,150 -m "benchmark" ./tests/benchmark
1717
feature_only: true
1818

1919
benchmark_fast:
2020
evm-type: benchmark
21-
fill-params: --no-html --fork=Prague --gas-benchmark-values 100 -m "benchmark" ./tests/benchmark
21+
fill-params: --no-html --skip-summary --fork=Prague --gas-benchmark-values 100 -m "benchmark" ./tests/benchmark
2222
feature_only: true
2323

2424
bal:
2525
evm-type: develop
26-
fill-params: --no-html --fork=Amsterdam --fill-static-tests
26+
fill-params: --no-html --skip-summary --fork=Amsterdam --fill-static-tests
2727
feature_only: true

packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,16 @@ def pytest_addoption(parser: pytest.Parser) -> None:
599599
"groups, phase 2 generates all supported fixture formats."
600600
),
601601
)
602+
test_group.addoption(
603+
"--skip-summary",
604+
action="store_true",
605+
dest="skip_summary",
606+
default=False,
607+
help=(
608+
"Skip computing expensive summary statistics "
609+
"(e.g., total account counts)."
610+
),
611+
)
602612

603613
optimize_gas_group = parser.getgroup(
604614
"optimize gas",
@@ -694,6 +704,9 @@ def pytest_configure(config: pytest.Config) -> None:
694704
config
695705
)
696706

707+
# Capture start time for duration reporting
708+
config.session_start_time = datetime.datetime.now() # type: ignore[attr-defined]
709+
697710
if is_help_or_collectonly_mode(config):
698711
return
699712

@@ -835,33 +848,63 @@ def pytest_terminal_summary(
835848
return
836849
stats = terminalreporter.stats
837850
if "passed" in stats and stats["passed"]:
851+
# Calculate duration
852+
duration = datetime.datetime.now() - config.session_start_time # type: ignore[attr-defined]
853+
total_seconds = int(duration.total_seconds())
854+
hours, remainder = divmod(total_seconds, 3600)
855+
minutes, seconds = divmod(remainder, 60)
856+
duration_str = f"{hours:02d}:{minutes:02d}:{seconds:02d}"
857+
838858
# Custom message for Phase 1 (pre-allocation group generation)
839859
session_instance: FillingSession = config.filling_session # type: ignore[attr-defined]
840860
if session_instance.phase_manager.is_pre_alloc_generation:
841-
# Generate summary stats
842-
pre_alloc_groups: PreAllocGroups
843-
if config.pluginmanager.hasplugin("xdist"):
844-
# Load pre-allocation groups from disk
845-
pre_alloc_groups = PreAllocGroups.from_folder(
846-
config.fixture_output.pre_alloc_groups_folder_path, # type: ignore[attr-defined]
847-
lazy_load=False,
861+
skip_summary = config.getoption("skip_summary")
862+
863+
if skip_summary:
864+
# Fast path: only count groups without loading file contents
865+
pre_alloc_groups: PreAllocGroups
866+
if config.pluginmanager.hasplugin("xdist"):
867+
pre_alloc_groups = PreAllocGroups.from_folder(
868+
config.fixture_output.pre_alloc_groups_folder_path, # type: ignore[attr-defined]
869+
lazy_load=True,
870+
)
871+
else:
872+
assert session_instance.pre_alloc_groups is not None
873+
pre_alloc_groups = session_instance.pre_alloc_groups
874+
total_groups = len(pre_alloc_groups.root)
875+
terminalreporter.write_sep(
876+
"=",
877+
f" Phase 1 Complete ({duration_str}): "
878+
f"Generated {total_groups} pre-alloc groups ",
879+
bold=True,
880+
green=True,
848881
)
849882
else:
850-
assert session_instance.pre_alloc_groups is not None
851-
pre_alloc_groups = session_instance.pre_alloc_groups
883+
# Full summary: load all groups and count accounts
884+
pre_alloc_groups_full: PreAllocGroups
885+
if config.pluginmanager.hasplugin("xdist"):
886+
pre_alloc_groups_full = PreAllocGroups.from_folder(
887+
config.fixture_output.pre_alloc_groups_folder_path, # type: ignore[attr-defined]
888+
lazy_load=False,
889+
)
890+
else:
891+
assert session_instance.pre_alloc_groups is not None
892+
pre_alloc_groups_full = session_instance.pre_alloc_groups
852893

853-
total_groups = len(pre_alloc_groups.root)
854-
total_accounts = sum(
855-
group.pre_account_count for group in pre_alloc_groups.values()
856-
)
894+
total_groups = len(pre_alloc_groups_full.root)
895+
total_accounts = sum(
896+
group.pre_account_count
897+
for group in pre_alloc_groups_full.values()
898+
)
857899

858-
terminalreporter.write_sep(
859-
"=",
860-
f" Phase 1 Complete: Generated {total_groups} pre-alloc "
861-
f"groups ({total_accounts} total accounts) ",
862-
bold=True,
863-
green=True,
864-
)
900+
terminalreporter.write_sep(
901+
"=",
902+
f" Phase 1 Complete ({duration_str}): "
903+
f"Generated {total_groups} pre-alloc groups "
904+
f"({total_accounts} total accounts) ",
905+
bold=True,
906+
green=True,
907+
)
865908

866909
else:
867910
# Normal message for fixture generation

0 commit comments

Comments
 (0)