Skip to content

Commit 38a5aa6

Browse files
committed
fix(consume): more bugfixes for creating pre_hash group subgroups & load balancing
1 parent dcad70a commit 38a5aa6

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

src/pytest_plugins/consume/consume.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,24 +563,30 @@ def pytest_generate_tests(metafunc):
563563
"""
564564
Generate test cases for every test fixture in all the JSON fixture files
565565
within the specified fixtures directory, or read from stdin if the directory is 'stdin'.
566+
567+
This function only applies to the test_blockchain_via_engine test function
568+
to avoid conflicts with other consume simulators.
566569
"""
567570
if "cache" in sys.argv:
568571
return
569572

573+
# Only apply to simulator test functions to avoid conflicts with other consume simulators
574+
if metafunc.function.__name__ not in ["test_blockchain_via_engine", "test_via_rlp"]:
575+
return
576+
570577
test_cases = metafunc.config.test_cases
571578
xdist_group_mapper = getattr(metafunc.config, "xdist_group_mapper", None)
572579
param_list = []
580+
573581
for test_case in test_cases:
574-
if test_case.format.format_name not in metafunc.config._supported_fixture_formats:
582+
# Check if _supported_fixture_formats is set, if not allow all formats
583+
supported_formats = getattr(metafunc.config, "_supported_fixture_formats", None)
584+
if supported_formats and test_case.format.format_name not in supported_formats:
575585
continue
576-
fork_markers = get_relative_fork_markers(test_case.fork, strict_mode=False)
577586

578-
# Append pre_hash (first 8 chars) to test ID for easier selection with --sim.limit
579-
test_id = test_case.id
580-
if hasattr(test_case, "pre_hash") and test_case.pre_hash:
581-
test_id = f"{test_case.id}[{test_case.pre_hash[:8]}]"
587+
fork_markers = get_relative_fork_markers(test_case.fork, strict_mode=False)
582588

583-
# Determine xdist group name
589+
# Determine xdist group name first
584590
if xdist_group_mapper and hasattr(test_case, "pre_hash") and test_case.pre_hash:
585591
# Use the mapper to get potentially split group name
586592
xdist_group_name = xdist_group_mapper.get_xdist_group_name(test_case)
@@ -591,6 +597,18 @@ def pytest_generate_tests(metafunc):
591597
# No pre_hash, use test ID
592598
xdist_group_name = test_case.id
593599

600+
# Create test ID showing the xdist group name for easier identification
601+
test_id = test_case.id
602+
if hasattr(test_case, "pre_hash") and test_case.pre_hash:
603+
# Show first 8 chars of xdist group name (includes sub-group if split)
604+
group_display = xdist_group_name[:8] if len(xdist_group_name) > 8 else xdist_group_name
605+
# If it's a split group (contains ':'), show that clearly
606+
if ":" in xdist_group_name:
607+
# Extract sub-group number for display
608+
pre_hash_part, sub_group = xdist_group_name.split(":", 1)
609+
group_display = f"{pre_hash_part[:8]}:{sub_group}"
610+
test_id = f"{test_case.id}[{group_display}]"
611+
594612
param = pytest.param(
595613
test_case,
596614
id=test_id,

0 commit comments

Comments
 (0)