@@ -566,6 +566,11 @@ def pytest_generate_tests(metafunc):
566
566
xdist_group_mapper = getattr (metafunc .config , "xdist_group_mapper" , None )
567
567
param_list = []
568
568
569
+ # Check if this is an enginex simulator (has enginex-specific enhancements)
570
+ is_enginex_function = (
571
+ hasattr (metafunc .config , "_supported_fixture_formats" )
572
+ and "blockchain_test_engine_x" in metafunc .config ._supported_fixture_formats
573
+ )
569
574
for test_case in test_cases :
570
575
# Check if _supported_fixture_formats is set, if not allow all formats
571
576
supported_formats = getattr (metafunc .config , "_supported_fixture_formats" , None )
@@ -574,36 +579,42 @@ def pytest_generate_tests(metafunc):
574
579
575
580
fork_markers = get_relative_fork_markers (test_case .fork , strict_mode = False )
576
581
577
- # Determine xdist group name first
578
- if xdist_group_mapper and hasattr (test_case , "pre_hash" ) and test_case .pre_hash :
579
- # Use the mapper to get potentially split group name
580
- xdist_group_name = xdist_group_mapper .get_xdist_group_name (test_case )
581
- elif hasattr (test_case , "pre_hash" ) and test_case .pre_hash :
582
- # No mapper or not enginex, use pre_hash directly
583
- xdist_group_name = test_case .pre_hash
584
- else :
585
- # No pre_hash, use test ID
586
- xdist_group_name = test_case .id
587
-
588
- # Create test ID showing the xdist group name for easier identification
582
+ # Basic test ID and markers (used by all consume tests)
589
583
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
-
600
- param = pytest .param (
601
- test_case ,
602
- id = test_id ,
603
- marks = [getattr (pytest .mark , m ) for m in fork_markers ]
604
- + [getattr (pytest .mark , test_case .format .format_name )]
605
- + [pytest .mark .xdist_group (name = xdist_group_name )],
606
- )
584
+ markers = [getattr (pytest .mark , m ) for m in fork_markers ] + [
585
+ getattr (pytest .mark , test_case .format .format_name )
586
+ ]
587
+
588
+ # Apply enginex-specific enhancements only for enginex functions
589
+ if is_enginex_function :
590
+ # Determine xdist group name for enginex load balancing
591
+ if xdist_group_mapper and hasattr (test_case , "pre_hash" ) and test_case .pre_hash :
592
+ # Use the mapper to get potentially split group name
593
+ xdist_group_name = xdist_group_mapper .get_xdist_group_name (test_case )
594
+ elif hasattr (test_case , "pre_hash" ) and test_case .pre_hash :
595
+ # No mapper or not enginex, use pre_hash directly
596
+ xdist_group_name = test_case .pre_hash
597
+ else :
598
+ # No pre_hash, use test ID
599
+ xdist_group_name = test_case .id
600
+
601
+ # Create enhanced test ID showing the xdist group name for easier identification
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 = (
605
+ xdist_group_name [:8 ] if len (xdist_group_name ) > 8 else xdist_group_name
606
+ )
607
+ # If it's a split group (contains ':'), show that clearly
608
+ if ":" in xdist_group_name :
609
+ # Extract sub-group number for display
610
+ pre_hash_part , sub_group = xdist_group_name .split (":" , 1 )
611
+ group_display = f"{ pre_hash_part [:8 ]} :{ sub_group } "
612
+ test_id = f"{ test_case .id } [{ group_display } ]"
613
+
614
+ # Add xdist group marker for load balancing
615
+ markers .append (pytest .mark .xdist_group (name = xdist_group_name ))
616
+
617
+ param = pytest .param (test_case , id = test_id , marks = markers )
607
618
param_list .append (param )
608
619
609
620
metafunc .parametrize ("test_case" , param_list )
0 commit comments