File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -290,16 +290,10 @@ def __exit__(
290
290
def found_str ():
291
291
return pformat ([record .message for record in self ], indent = 2 )
292
292
293
- def re_emit_without ( exc = None ):
293
+ def re_emit ( remove = None ):
294
294
exceptions = self ._list .copy ()
295
- if exc :
296
- exceptions .remove (exc )
297
- else :
298
- # remove the first exception that matches the expected warning
299
- for r in exceptions :
300
- if issubclass (r .category , self .expected_warning ):
301
- exceptions .remove (r )
302
- break
295
+ if remove :
296
+ exceptions .remove (remove )
303
297
304
298
for e in exceptions :
305
299
warnings .warn_explicit (
@@ -324,7 +318,7 @@ def re_emit_without(exc=None):
324
318
for r in self :
325
319
if issubclass (r .category , self .expected_warning ):
326
320
if re .compile (self .match_expr ).search (str (r .message )):
327
- re_emit_without (r )
321
+ re_emit (r )
328
322
break
329
323
else :
330
324
fail (
@@ -333,6 +327,5 @@ def re_emit_without(exc=None):
333
327
Regex: { self .match_expr }
334
328
Emitted warnings: { found_str ()} """
335
329
)
336
- # can add warnings.warn for all other warn objects besides this here
337
330
else :
338
- re_emit_without ()
331
+ re_emit ()
You can’t perform that action at this time.
0 commit comments