@@ -242,16 +242,16 @@ def pytest_addoption(parser: pytest.Parser):
242
242
),
243
243
)
244
244
test_group .addoption (
245
- "--generate-grouped- pre-allocs " ,
245
+ "--generate-pre-alloc-groups " ,
246
246
action = "store_true" ,
247
- dest = "generate_grouped_pre_allocs " ,
247
+ dest = "generate_pre_alloc_groups " ,
248
248
default = False ,
249
249
help = "Generate pre-allocation groups (phase 1 only)." ,
250
250
)
251
251
test_group .addoption (
252
- "--use-grouped- pre-allocs " ,
252
+ "--use-pre-alloc-groups " ,
253
253
action = "store_true" ,
254
- dest = "use_grouped_pre_allocs " ,
254
+ dest = "use_pre_alloc_groups " ,
255
255
default = False ,
256
256
help = "Fill tests using existing pre-allocation groups (phase 2 only)." ,
257
257
)
@@ -286,20 +286,20 @@ def pytest_sessionstart(session: pytest.Session):
286
286
load the pre-allocation groups for phase 2 execution.
287
287
"""
288
288
# Initialize empty pre-allocation groups container for phase 1
289
- if session .config .getoption ("generate_grouped_pre_allocs " ):
290
- session .config .grouped_pre_allocs = PreAllocGroups (root = {}) # type: ignore[attr-defined]
289
+ if session .config .getoption ("generate_pre_alloc_groups " ):
290
+ session .config .pre_alloc_groups = PreAllocGroups (root = {}) # type: ignore[attr-defined]
291
291
292
292
# Load the pre-allocation groups for phase 2
293
- if session .config .getoption ("use_grouped_pre_allocs " ):
294
- grouped_pre_allocs_folder = session .config .fixture_output .grouped_pre_allocs_folder_path # type: ignore[attr-defined]
295
- if grouped_pre_allocs_folder .exists ():
296
- session .config .grouped_pre_allocs = PreAllocGroups .from_folder ( # type: ignore[attr-defined]
297
- grouped_pre_allocs_folder
293
+ if session .config .getoption ("use_pre_alloc_groups " ):
294
+ pre_alloc_groups_folder = session .config .fixture_output .pre_alloc_groups_folder_path # type: ignore[attr-defined]
295
+ if pre_alloc_groups_folder .exists ():
296
+ session .config .pre_alloc_groups = PreAllocGroups .from_folder ( # type: ignore[attr-defined]
297
+ pre_alloc_groups_folder
298
298
)
299
299
else :
300
300
pytest .exit (
301
- f"Pre-allocation groups folder not found: { grouped_pre_allocs_folder } . "
302
- "Run phase 1 with --generate-grouped- pre-allocs first." ,
301
+ f"Pre-allocation groups folder not found: { pre_alloc_groups_folder } . "
302
+ "Run phase 1 with --generate-pre-alloc-groups first." ,
303
303
returncode = pytest .ExitCode .USAGE_ERROR ,
304
304
)
305
305
@@ -339,7 +339,7 @@ def pytest_configure(config):
339
339
if (
340
340
not config .getoption ("disable_html" )
341
341
and config .getoption ("htmlpath" ) is None
342
- and not config .getoption ("generate_grouped_pre_allocs " )
342
+ and not config .getoption ("generate_pre_alloc_groups " )
343
343
):
344
344
config .option .htmlpath = config .fixture_output .directory / default_html_report_file_path ()
345
345
@@ -416,21 +416,21 @@ def pytest_terminal_summary(
416
416
stats = terminalreporter .stats
417
417
if "passed" in stats and stats ["passed" ]:
418
418
# Custom message for Phase 1 (pre-allocation group generation)
419
- if config .getoption ("generate_grouped_pre_allocs " ):
419
+ if config .getoption ("generate_pre_alloc_groups " ):
420
420
# Generate summary stats
421
- grouped_pre_allocs : PreAllocGroups
421
+ pre_alloc_groups : PreAllocGroups
422
422
if config .pluginmanager .hasplugin ("xdist" ):
423
423
# Load pre-allocation groups from disk
424
- grouped_pre_allocs = PreAllocGroups .from_folder (
425
- config .fixture_output .grouped_pre_allocs_folder_path # type: ignore[attr-defined]
424
+ pre_alloc_groups = PreAllocGroups .from_folder (
425
+ config .fixture_output .pre_alloc_groups_folder_path # type: ignore[attr-defined]
426
426
)
427
427
else :
428
- assert hasattr (config , "grouped_pre_allocs " )
429
- grouped_pre_allocs = config .grouped_pre_allocs # type: ignore[attr-defined]
428
+ assert hasattr (config , "pre_alloc_groups " )
429
+ pre_alloc_groups = config .pre_alloc_groups # type: ignore[attr-defined]
430
430
431
- total_groups = len (grouped_pre_allocs .root )
431
+ total_groups = len (pre_alloc_groups .root )
432
432
total_accounts = sum (
433
- group .pre_account_count for group in grouped_pre_allocs .root .values ()
433
+ group .pre_account_count for group in pre_alloc_groups .root .values ()
434
434
)
435
435
436
436
terminalreporter .write_sep (
@@ -881,32 +881,32 @@ def __init__(self, *args, **kwargs):
881
881
882
882
# Phase 1: Generate pre-allocation groups
883
883
if fixture_format is BlockchainEngineXFixture and request .config .getoption (
884
- "generate_grouped_pre_allocs "
884
+ "generate_pre_alloc_groups "
885
885
):
886
886
self .update_pre_alloc_groups (
887
- request .config .grouped_pre_allocs , fork , request .node .nodeid
887
+ request .config .pre_alloc_groups , fork , request .node .nodeid
888
888
)
889
889
return # Skip fixture generation in phase 1
890
890
891
891
# Phase 2: Use pre-allocation groups (only for BlockchainEngineXFixture)
892
892
pre_alloc_hash = None
893
893
if fixture_format is BlockchainEngineXFixture and request .config .getoption (
894
- "use_grouped_pre_allocs "
894
+ "use_pre_alloc_groups "
895
895
):
896
896
pre_alloc_hash = self .compute_pre_alloc_group_hash (fork = fork )
897
- if pre_alloc_hash not in request .config .grouped_pre_allocs :
897
+ if pre_alloc_hash not in request .config .pre_alloc_groups :
898
898
pre_alloc_path = (
899
- request .config .fixture_output .grouped_pre_allocs_folder_path
899
+ request .config .fixture_output .pre_alloc_groups_folder_path
900
900
/ pre_alloc_hash
901
901
)
902
902
raise ValueError (
903
903
f"Pre-allocation hash { pre_alloc_hash } not found in "
904
904
f"pre-allocation groups. "
905
905
f"Please check the pre-allocation groups file at: { pre_alloc_path } . "
906
- "Make sure phase 1 (--generate-grouped- pre-allocs ) was run "
906
+ "Make sure phase 1 (--generate-pre-alloc-groups ) was run "
907
907
"before phase 2."
908
908
)
909
- group : PreAllocGroup = request .config .grouped_pre_allocs [pre_alloc_hash ]
909
+ group : PreAllocGroup = request .config .pre_alloc_groups [pre_alloc_hash ]
910
910
self .pre = group .pre
911
911
912
912
fixture = self .generate (
@@ -918,14 +918,14 @@ def __init__(self, *args, **kwargs):
918
918
# Post-process for Engine X format (add pre_hash and state diff)
919
919
if (
920
920
fixture_format is BlockchainEngineXFixture
921
- and request .config .getoption ("use_grouped_pre_allocs " )
921
+ and request .config .getoption ("use_pre_alloc_groups " )
922
922
and pre_alloc_hash is not None
923
923
):
924
924
fixture .pre_hash = pre_alloc_hash
925
925
926
926
# Calculate state diff for efficiency
927
927
if hasattr (fixture , "post_state" ) and fixture .post_state is not None :
928
- group = request .config .grouped_pre_allocs [pre_alloc_hash ]
928
+ group = request .config .pre_alloc_groups [pre_alloc_hash ]
929
929
fixture .post_state_diff = calculate_post_state_diff (
930
930
fixture .post_state , group .pre
931
931
)
@@ -968,12 +968,12 @@ def pytest_generate_tests(metafunc: pytest.Metafunc):
968
968
"""
969
969
for test_type in BaseTest .spec_types .values ():
970
970
if test_type .pytest_parameter_name () in metafunc .fixturenames :
971
- generate_grouped_pre_allocs = metafunc .config .getoption (
972
- "generate_grouped_pre_allocs " , False
971
+ generate_pre_alloc_groups = metafunc .config .getoption (
972
+ "generate_pre_alloc_groups " , False
973
973
)
974
- use_grouped_pre_allocs = metafunc .config .getoption ("use_grouped_pre_allocs " , False )
974
+ use_pre_alloc_groups = metafunc .config .getoption ("use_pre_alloc_groups " , False )
975
975
976
- if generate_grouped_pre_allocs or use_grouped_pre_allocs :
976
+ if generate_pre_alloc_groups or use_pre_alloc_groups :
977
977
# When pre-allocation group flags are set, only generate BlockchainEngineXFixture
978
978
supported_formats = [
979
979
format_item
@@ -1080,12 +1080,12 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus: int):
1080
1080
"""
1081
1081
# Save pre-allocation groups after phase 1
1082
1082
fixture_output = session .config .fixture_output # type: ignore[attr-defined]
1083
- if session .config .getoption ("generate_grouped_pre_allocs " ) and hasattr (
1084
- session .config , "grouped_pre_allocs "
1083
+ if session .config .getoption ("generate_pre_alloc_groups " ) and hasattr (
1084
+ session .config , "pre_alloc_groups "
1085
1085
):
1086
- grouped_pre_allocs_folder = fixture_output .grouped_pre_allocs_folder_path
1087
- grouped_pre_allocs_folder .mkdir (parents = True , exist_ok = True )
1088
- session .config .grouped_pre_allocs .to_folder (grouped_pre_allocs_folder )
1086
+ pre_alloc_groups_folder = fixture_output .pre_alloc_groups_folder_path
1087
+ pre_alloc_groups_folder .mkdir (parents = True , exist_ok = True )
1088
+ session .config .pre_alloc_groups .to_folder (pre_alloc_groups_folder )
1089
1089
return
1090
1090
1091
1091
if xdist .is_xdist_worker (session ):
@@ -1100,7 +1100,7 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus: int):
1100
1100
1101
1101
# Generate index file for all produced fixtures.
1102
1102
if session .config .getoption ("generate_index" ) and not session .config .getoption (
1103
- "generate_grouped_pre_allocs "
1103
+ "generate_pre_alloc_groups "
1104
1104
):
1105
1105
generate_fixtures_index (
1106
1106
fixture_output .directory , quiet_mode = True , force_flag = False , disable_infer_format = False
0 commit comments