Skip to content

Commit c843600

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

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

561+
# Only apply to simulator test functions to avoid conflicts with other consume simulators
562+
if metafunc.function.__name__ not in ["test_blockchain_via_engine", "test_via_rlp"]:
563+
return
564+
558565
test_cases = metafunc.config.test_cases
559566
xdist_group_mapper = getattr(metafunc.config, "xdist_group_mapper", None)
560567
param_list = []
568+
561569
for test_case in test_cases:
562-
if test_case.format.format_name not in metafunc.config._supported_fixture_formats:
570+
# Check if _supported_fixture_formats is set, if not allow all formats
571+
supported_formats = getattr(metafunc.config, "_supported_fixture_formats", None)
572+
if supported_formats and test_case.format.format_name not in supported_formats:
563573
continue
564-
fork_markers = get_relative_fork_markers(test_case.fork, strict_mode=False)
565574

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

571-
# Determine xdist group name
577+
# Determine xdist group name first
572578
if xdist_group_mapper and hasattr(test_case, "pre_hash") and test_case.pre_hash:
573579
# Use the mapper to get potentially split group name
574580
xdist_group_name = xdist_group_mapper.get_xdist_group_name(test_case)
@@ -579,6 +585,18 @@ def pytest_generate_tests(metafunc):
579585
# No pre_hash, use test ID
580586
xdist_group_name = test_case.id
581587

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

0 commit comments

Comments
 (0)