Skip to content

Commit b2b0401

Browse files
committed
fix(consume): more bugfixes for creating pre_hash group subgroups & load balancing
1 parent 7bacee4 commit b2b0401

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
@@ -552,24 +552,30 @@ def pytest_generate_tests(metafunc):
552552
"""
553553
Generate test cases for every test fixture in all the JSON fixture files
554554
within the specified fixtures directory, or read from stdin if the directory is 'stdin'.
555+
556+
This function only applies to the test_blockchain_via_engine test function
557+
to avoid conflicts with other consume simulators.
555558
"""
556559
if "cache" in sys.argv:
557560
return
558561

562+
# Only apply to test_blockchain_via_engine function (used by enginex and engine simulators)
563+
if metafunc.function.__name__ != "test_blockchain_via_engine":
564+
return
565+
559566
test_cases = metafunc.config.test_cases
560567
xdist_group_mapper = getattr(metafunc.config, "xdist_group_mapper", None)
561568
param_list = []
569+
562570
for test_case in test_cases:
563-
if test_case.format.format_name not in metafunc.config._supported_fixture_formats:
571+
# Check if _supported_fixture_formats is set, if not allow all formats
572+
supported_formats = getattr(metafunc.config, "_supported_fixture_formats", None)
573+
if supported_formats and test_case.format.format_name not in supported_formats:
564574
continue
565-
fork_markers = get_relative_fork_markers(test_case.fork, strict_mode=False)
566575

567-
# Append pre_hash (first 8 chars) to test ID for easier selection with --sim.limit
568-
test_id = test_case.id
569-
if hasattr(test_case, "pre_hash") and test_case.pre_hash:
570-
test_id = f"{test_case.id}[{test_case.pre_hash[:8]}]"
576+
fork_markers = get_relative_fork_markers(test_case.fork, strict_mode=False)
571577

572-
# Determine xdist group name
578+
# Determine xdist group name first
573579
if xdist_group_mapper and hasattr(test_case, "pre_hash") and test_case.pre_hash:
574580
# Use the mapper to get potentially split group name
575581
xdist_group_name = xdist_group_mapper.get_xdist_group_name(test_case)
@@ -580,6 +586,18 @@ def pytest_generate_tests(metafunc):
580586
# No pre_hash, use test ID
581587
xdist_group_name = test_case.id
582588

589+
# Create test ID showing the xdist group name for easier identification
590+
test_id = test_case.id
591+
if hasattr(test_case, "pre_hash") and test_case.pre_hash:
592+
# Show first 8 chars of xdist group name (includes sub-group if split)
593+
group_display = xdist_group_name[:8] if len(xdist_group_name) > 8 else xdist_group_name
594+
# If it's a split group (contains ':'), show that clearly
595+
if ":" in xdist_group_name:
596+
# Extract sub-group number for display
597+
pre_hash_part, sub_group = xdist_group_name.split(":", 1)
598+
group_display = f"{pre_hash_part[:8]}:{sub_group}"
599+
test_id = f"{test_case.id}[{group_display}]"
600+
583601
param = pytest.param(
584602
test_case,
585603
id=test_id,

0 commit comments

Comments
 (0)