@@ -110,7 +110,6 @@ def call_me_maybe(e):
110110 "check_run" ,
111111 stream = scm ,
112112 get_current_time = lambda : 0.0 ,
113- report_error = lambda e : None ,
114113 record_count = lambda a , b , c : None ,
115114 record_timer = lambda a , b , c : None ,
116115 )
@@ -149,7 +148,6 @@ def comment_handler(e):
149148 "comment" ,
150149 stream = scm ,
151150 get_current_time = lambda : 0.0 ,
152- report_error = lambda e : None ,
153151 record_count = lambda a , b , c : None ,
154152 record_timer = lambda a , b , c : None ,
155153 )
@@ -196,7 +194,6 @@ def pr_handler(e):
196194 "pull_request" ,
197195 stream = scm ,
198196 get_current_time = lambda : 0.0 ,
199- report_error = lambda e : None ,
200197 record_count = lambda a , b , c : None ,
201198 record_timer = lambda a , b , c : None ,
202199 )
@@ -246,7 +243,6 @@ def record_timer(key, amount, tags):
246243 "check_run" ,
247244 stream = scm ,
248245 get_current_time = lambda : 200.0 ,
249- report_error = lambda e : None ,
250246 record_count = record_count ,
251247 record_distribution = record_distribution ,
252248 record_timer = record_timer ,
@@ -287,7 +283,6 @@ def record_count(key, amount, tags):
287283 "check_run" ,
288284 stream = SourceCodeManagerEventStream (),
289285 get_current_time = lambda : 0.0 ,
290- report_error = lambda e : None ,
291286 record_count = record_count ,
292287 record_timer = lambda a , b , c : None ,
293288 )
@@ -328,7 +323,6 @@ def record_count(key, amount, tags):
328323 "check_run" ,
329324 stream = scm ,
330325 get_current_time = lambda : 0.0 ,
331- report_error = lambda e : None ,
332326 record_count = record_count ,
333327 record_timer = lambda a , b , c : None ,
334328 )
@@ -341,29 +335,22 @@ def record_count(key, amount, tags):
341335
342336
343337def test_run_listener_malformed_input ():
344- error = None
345338 metrics = []
346339
347- def report_error (e ):
348- nonlocal error
349- error = e
350-
351340 def record_count (a , b , c ):
352341 metrics .append ((a , b , c ))
353342
354- # Implicitly tests no exception was raised.
355- run_listener (
356- "t" ,
357- "" ,
358- "check_run" ,
359- stream = SourceCodeManagerEventStream (),
360- get_current_time = lambda : 0.0 ,
361- report_error = report_error ,
362- record_count = record_count ,
363- record_timer = lambda a , b , c : None ,
364- )
343+ with pytest .raises (msgspec .MsgspecError ):
344+ run_listener (
345+ "t" ,
346+ "" ,
347+ "check_run" ,
348+ stream = SourceCodeManagerEventStream (),
349+ get_current_time = lambda : 0.0 ,
350+ record_count = record_count ,
351+ record_timer = lambda a , b , c : None ,
352+ )
365353
366- assert isinstance (error , msgspec .MsgspecError )
367354 assert metrics == [("sentry.scm.run_listener.failed" , 1 , {"reason" : "parse" , "fn" : "t" })]
368355
369356
0 commit comments