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