@@ -129,9 +129,9 @@ def run_json_tests(self, effects: dict, estimators: dict, f_flag: bool = False,
129
129
test ["estimator" ] = estimators [test ["estimator" ]]
130
130
if "mutations" in test :
131
131
if test ["estimate_type" ] == "coefficient" :
132
- msg = self ._run_coefficient_test (test = test , f_flag = f_flag , effects = effects )
132
+ failed , msg = self ._run_coefficient_test (test = test , f_flag = f_flag , effects = effects )
133
133
else :
134
- msg = self ._run_ate_test (test = test , f_flag = f_flag , effects = effects , mutates = mutates )
134
+ failed , msg = self ._run_ate_test (test = test , f_flag = f_flag , effects = effects , mutates = mutates )
135
135
self ._append_to_file (msg , logging .INFO )
136
136
else :
137
137
outcome_variable = next (
@@ -158,8 +158,10 @@ def run_json_tests(self, effects: dict, estimators: dict, f_flag: bool = False,
158
158
+ f"control value = { test ['control_value' ]} , treatment value = { test ['treatment_value' ]} \n "
159
159
+ f"Result: { 'FAILED' if failed else 'Passed' } "
160
160
)
161
- print (msg )
162
161
self ._append_to_file (msg , logging .INFO )
162
+ test ["failed" ] = failed
163
+ print (msg )
164
+ return self .test_plan ["tests" ]
163
165
164
166
def _run_coefficient_test (self , test : dict , f_flag : bool , effects : dict ):
165
167
"""Builds structures and runs test case for tests with an estimate_type of 'coefficient'.
@@ -181,16 +183,16 @@ def _run_coefficient_test(self, test: dict, f_flag: bool, effects: dict):
181
183
estimate_type = "coefficient" ,
182
184
effect_modifier_configuration = {self .scenario .variables [v ] for v in test .get ("effect_modifiers" , [])},
183
185
)
184
- result = self ._execute_test_case (causal_test_case = causal_test_case , test = test , f_flag = f_flag )
186
+ failed , result = self ._execute_test_case (causal_test_case = causal_test_case , test = test , f_flag = f_flag )
185
187
msg = (
186
188
f"Executing test: { test ['name' ]} \n "
187
189
+ f" { causal_test_case } \n "
188
190
+ " "
189
- + ("\n " ).join (str (result [ 1 ] ).split ("\n " ))
191
+ + ("\n " ).join (str (result ).split ("\n " ))
190
192
+ "==============\n "
191
- + f" Result: { 'FAILED' if result [ 0 ] else 'Passed' } "
193
+ + f" Result: { 'FAILED' if failed else 'Passed' } "
192
194
)
193
- return msg
195
+ return failed , msg
194
196
195
197
def _run_ate_test (self , test : dict , f_flag : bool , effects : dict , mutates : dict ):
196
198
"""Builds structures and runs test case for tests with an estimate_type of 'ate'.
@@ -224,7 +226,7 @@ def _run_ate_test(self, test: dict, f_flag: bool, effects: dict, mutates: dict):
224
226
+ f" Number of concrete tests for test case: { str (len (concrete_tests ))} \n "
225
227
+ f" { failures } /{ len (concrete_tests )} failed for { test ['name' ]} "
226
228
)
227
- return msg
229
+ return failures , msg
228
230
229
231
def _execute_tests (self , concrete_tests , test , f_flag ):
230
232
failures = 0
0 commit comments