@@ -213,23 +213,40 @@ def process_data():
213213 with pytest .raises (subprocess .CalledProcessError ) as excinfo :
214214 subprocess .check_output ([sys .executable , str (app )], stderr = subprocess .STDOUT )
215215
216- output = excinfo .value .output .decode (' utf-8' )
216+ output = excinfo .value .output .decode (" utf-8" )
217217
218218 assert "ZeroDivisionError" in output
219219 assert "code_variables" in output
220-
220+
221221 captured_vars = []
222- for var_name in ['var_a' , 'var_b' , 'var_c' , 'var_d' , 'var_e' ,
223- 'var_f' , 'var_g' , 'var_h' , 'var_i' , 'var_j' ,
224- 'var_k' , 'var_l' , 'var_m' , 'var_n' , 'var_o' ,
225- 'var_p' , 'var_q' , 'var_r' , 'var_s' , 'var_t' , 'var_u' ]:
222+ for var_name in [
223+ "var_a" ,
224+ "var_b" ,
225+ "var_c" ,
226+ "var_d" ,
227+ "var_e" ,
228+ "var_f" ,
229+ "var_g" ,
230+ "var_h" ,
231+ "var_i" ,
232+ "var_j" ,
233+ "var_k" ,
234+ "var_l" ,
235+ "var_m" ,
236+ "var_n" ,
237+ "var_o" ,
238+ "var_p" ,
239+ "var_q" ,
240+ "var_r" ,
241+ "var_s" ,
242+ "var_t" ,
243+ "var_u" ,
244+ ]:
226245 if f"'{ var_name } '" in output :
227246 captured_vars .append (var_name )
228-
229- assert len (captured_vars ) > 0 , "Should capture at least some variables"
230- assert len (captured_vars ) < 21 , f"Should not capture all 21 variables due to 20KB size limit (each truncated to 1024 chars = 21KB total), but got { len (captured_vars )} : { captured_vars } "
231-
232- print (f"Captured { len (captured_vars )} variables: { captured_vars } " )
247+
248+ assert len (captured_vars ) > 0
249+ assert len (captured_vars ) < 21
233250
234251
235252def test_code_variables_disabled_capture (tmpdir ):
@@ -264,7 +281,7 @@ def trigger_error():
264281 with pytest .raises (subprocess .CalledProcessError ) as excinfo :
265282 subprocess .check_output ([sys .executable , str (app )], stderr = subprocess .STDOUT )
266283
267- output = excinfo .value .output .decode (' utf-8' )
284+ output = excinfo .value .output .decode (" utf-8" )
268285
269286 assert "ZeroDivisionError" in output
270287 assert "'code_variables':" not in output
@@ -308,7 +325,7 @@ def process_data():
308325 with pytest .raises (subprocess .CalledProcessError ) as excinfo :
309326 subprocess .check_output ([sys .executable , str (app )], stderr = subprocess .STDOUT )
310327
311- output = excinfo .value .output .decode (' utf-8' )
328+ output = excinfo .value .output .decode (" utf-8" )
312329
313330 assert "ZeroDivisionError" in output
314331 assert "'code_variables':" not in output
0 commit comments