@@ -729,13 +729,15 @@ async def _collect_result(config, lst, max_retry):
729729 except Exception :
730730 _log_eval_error ("error" , data if "data" in locals () else None , passed = False )
731731 raise
732+
732733 if asyncio .iscoroutinefunction (test_func ):
733734 return create_dynamically_parameterized_wrapper (test_func , wrapper_body , test_param_names )
734735 else :
736+
735737 def sync_wrapper_body (** kwargs ):
736738 return asyncio .run (wrapper_body (** kwargs ))
737- return create_dynamically_parameterized_wrapper (test_func , sync_wrapper_body , test_param_names )
738739
740+ return create_dynamically_parameterized_wrapper (test_func , sync_wrapper_body , test_param_names )
739741
740742 # Create the pytest wrapper
741743 pytest_wrapper = create_wrapper_with_signature ()
@@ -763,6 +765,7 @@ def create_dual_mode_wrapper() -> Callable:
763765 is_async = asyncio .iscoroutinefunction (test_func )
764766
765767 if is_async :
768+
766769 async def dual_mode_wrapper (* args , ** kwargs ):
767770 # Check if this is a direct call with the expected signature
768771 if mode == "pointwise" :
@@ -789,20 +792,30 @@ async def dual_mode_wrapper(*args, **kwargs):
789792
790793 # If not a direct call, use the pytest wrapper
791794 return await pytest_wrapper (* args , ** kwargs )
792-
795+
793796 _dual_model_wrapper_fn = dual_mode_wrapper
794797 else :
798+
795799 def dual_mode_wrapper (* args , ** kwargs ):
796800 if mode == "pointwise" :
797801 if len (args ) == 1 and isinstance (args [0 ], EvaluationRow ) and not kwargs :
798802 return test_func (row = args [0 ])
799803 else :
800- if len (args ) == 1 and isinstance (args [0 ], list ) and all (isinstance (r , EvaluationRow ) for r in args [0 ]) and not kwargs :
804+ if (
805+ len (args ) == 1
806+ and isinstance (args [0 ], list )
807+ and all (isinstance (r , EvaluationRow ) for r in args [0 ])
808+ and not kwargs
809+ ):
801810 return test_func (rows = args [0 ])
802- if "rows" in kwargs and isinstance (kwargs ["rows" ], list ) and all (isinstance (r , EvaluationRow ) for r in kwargs ["rows" ]):
811+ if (
812+ "rows" in kwargs
813+ and isinstance (kwargs ["rows" ], list )
814+ and all (isinstance (r , EvaluationRow ) for r in kwargs ["rows" ])
815+ ):
803816 return test_func (** kwargs )
804817 return pytest_wrapper (* args , ** kwargs )
805-
818+
806819 _dual_model_wrapper_fn = dual_mode_wrapper
807820
808821 # Copy all attributes from the pytest wrapper to our dual mode wrapper
0 commit comments